Statistics
| Branch: | Tag: | Revision:

root / snf-webproject / extras / snf_manage_bash_completion @ 4319c408

History | View | Annotate | Download (1.2 kB)

1 b29a81b1 Kostas Papadimitriou
# #########################################################################
2 e82a761a Kostas Papadimitriou
# This bash script adds tab-completion feature to snf-manage
3 b29a81b1 Kostas Papadimitriou
#
4 b29a81b1 Kostas Papadimitriou
# Testing it out without installing
5 b29a81b1 Kostas Papadimitriou
# =================================
6 b29a81b1 Kostas Papadimitriou
#
7 b29a81b1 Kostas Papadimitriou
# To test out the completion without "installing" this, just run this file
8 b29a81b1 Kostas Papadimitriou
# directly, like so:
9 b29a81b1 Kostas Papadimitriou
#
10 e82a761a Kostas Papadimitriou
#     . ~/path/to/snf_manage_bash_completion
11 b29a81b1 Kostas Papadimitriou
#
12 b29a81b1 Kostas Papadimitriou
# Note: There's a dot ('.') at the beginning of that command.
13 b29a81b1 Kostas Papadimitriou
#
14 b29a81b1 Kostas Papadimitriou
# After you do that, tab completion will immediately be made available in your
15 b29a81b1 Kostas Papadimitriou
# current Bash shell. But it won't be available next time you log in.
16 b29a81b1 Kostas Papadimitriou
#
17 b29a81b1 Kostas Papadimitriou
# Installing
18 b29a81b1 Kostas Papadimitriou
# ==========
19 b29a81b1 Kostas Papadimitriou
#
20 b29a81b1 Kostas Papadimitriou
# To install this, point to this file from your .bash_profile, like so:
21 b29a81b1 Kostas Papadimitriou
#
22 e82a761a Kostas Papadimitriou
#     . ~/path/to/snf_manage_bash_completion
23 b29a81b1 Kostas Papadimitriou
#
24 b29a81b1 Kostas Papadimitriou
# Do the same in your .bashrc if .bashrc doesn't invoke .bash_profile.
25 b29a81b1 Kostas Papadimitriou
#
26 b29a81b1 Kostas Papadimitriou
# Settings will take effect the next time you log in.
27 b29a81b1 Kostas Papadimitriou
#
28 b29a81b1 Kostas Papadimitriou
# Uninstalling
29 b29a81b1 Kostas Papadimitriou
# ============
30 b29a81b1 Kostas Papadimitriou
#
31 b29a81b1 Kostas Papadimitriou
# To uninstall, just remove the line from your .bash_profile and .bashrc.
32 b29a81b1 Kostas Papadimitriou
33 b29a81b1 Kostas Papadimitriou
_synnefo_completion()
34 b29a81b1 Kostas Papadimitriou
{
35 b29a81b1 Kostas Papadimitriou
    COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
36 b29a81b1 Kostas Papadimitriou
                   COMP_CWORD=$COMP_CWORD \
37 b29a81b1 Kostas Papadimitriou
	               DJANGO_AUTO_COMPLETE=1 $1 ) )
38 b29a81b1 Kostas Papadimitriou
}
39 b29a81b1 Kostas Papadimitriou
complete -F _synnefo_completion -o default snf-manage