Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added files that can be used to enable tab-completion in bash for 'buildbot' and 'buildslave' commands.
- Loading branch information
Elmir Jagudin
committed
Jun 3, 2013
1 parent
c9cbd58
commit 9f0b93c
Showing
4 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# | ||
# This file installs BASH completions for 'buildbot' command. | ||
# | ||
|
||
_buildbot() | ||
{ | ||
local buildbot_subcommands=" | ||
create-master upgrade-master start stop restart reconfig sighup user | ||
sendchange debugclient statuslog statusgui try tryserver checkconfig" | ||
|
||
local cur=${COMP_WORDS[COMP_CWORD]} | ||
local subcommand= | ||
local subcommand_args= | ||
local i=1 | ||
|
||
# | ||
# 'parse' the command line so far | ||
# figure out if we have subcommand specified and any arguments to it | ||
# | ||
|
||
# skip global options | ||
while [[ "${COMP_WORDS[$i]}" == -* ]]; | ||
do | ||
i=$(($i+1)) | ||
done | ||
|
||
# save subcommand | ||
subcommand=${COMP_WORDS[$i]} | ||
i=$(($i+1)) | ||
|
||
# skip subcommand options | ||
while [[ "${COMP_WORDS[$i]}" == -* ]]; | ||
do | ||
i=$(($i+1)) | ||
done | ||
|
||
# save subcommand arguments | ||
subcommand_args=${COMP_WORDS[@]:$i:${#COMP_WORDS[@]}} | ||
|
||
if [ "$cur" == "$subcommand" ]; then | ||
# suggest buildbot subcommands | ||
COMPREPLY=( $(compgen -W "$buildbot_subcommands" $cur) ) | ||
elif [ "$cur" == "$subcommand_args" ]; then | ||
# we are at first subcommand argument | ||
case $subcommand in | ||
# these command take base directory as first argument, | ||
# suggest directories | ||
upgrade-master|create-master|start|stop|restart|reconfig|sighup) | ||
COMPREPLY=( $(compgen -A directory $cur) ) | ||
;; | ||
# checkconfig takes a filename or directory as first argument | ||
checkconfig) | ||
COMPREPLY=( $(compgen -A file $cur) ) | ||
;; | ||
esac | ||
fi | ||
} | ||
|
||
complete -F _buildbot buildbot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# | ||
# This file installs BASH completions for 'buildslave' command. | ||
# | ||
|
||
_buildslave() | ||
{ | ||
local buildslave_subcommands=" | ||
create-slave upgrade-slave start stop restart" | ||
|
||
local cur=${COMP_WORDS[COMP_CWORD]} | ||
local subcommand= | ||
local subcommand_args= | ||
local i=1 | ||
|
||
# | ||
# 'parse' the command line so far | ||
# figure out if we have subcommand specified and any arguments to it | ||
# | ||
|
||
# skip global options | ||
while [[ "${COMP_WORDS[$i]}" == -* ]]; | ||
do | ||
i=$(($i+1)) | ||
done | ||
|
||
# save subcommand | ||
subcommand=${COMP_WORDS[$i]} | ||
i=$(($i+1)) | ||
|
||
# skip subcommand options | ||
while [[ "${COMP_WORDS[$i]}" == -* ]]; | ||
do | ||
i=$(($i+1)) | ||
done | ||
|
||
# save subcommand arguments | ||
subcommand_args=${COMP_WORDS[@]:$i:${#COMP_WORDS[@]}} | ||
|
||
if [ "$cur" == "$subcommand" ]; then | ||
# suggest buildbot subcommands | ||
COMPREPLY=( $(compgen -W "$buildslave_subcommands" $cur) ) | ||
elif [ "$cur" == "$subcommand_args" ]; then | ||
# we are at first subcommand argument | ||
# all subcommands can have slave base directory as first argument | ||
# suggest directories | ||
COMPREPLY=( $(compgen -A directory $cur) ) | ||
fi | ||
} | ||
|
||
complete -F _buildslave buildslave |