Skip to content

Commit

Permalink
added directory completion for config verb, e.g. for --extend
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaschke committed Mar 8, 2016
1 parent 17f24b3 commit fb06718
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions completion/catkin_tools-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,20 @@ _catkin()
fi
;;
config)
if [[ ${cur} != -* && "--whitelist --blacklist" == *$(_catkin_last_option)* ]] ; then
COMPREPLY=($(compgen -W "$(_catkin_pkgs)" -- ${cur}))
else
local catkin_config_opts=$(catkin config --help 2>&1 | sed -ne $OPTS_FILTER | sort -u)
COMPREPLY=($(compgen -W "${catkin_config_opts}" -- ${cur}))
# list all options
local catkin_config_opts=$(catkin config --help 2>&1 | sed -ne $OPTS_FILTER | sort -u)
COMPREPLY=($(compgen -W "${catkin_config_opts}" -- ${cur}))

# list package names when --whitelist or --blacklist was given as last option
if [[ ${cur} != -* && $(_catkin_last_option) == --*list ]] ; then
COMPREPLY+=($(compgen -W "$(_catkin_pkgs)" -- ${cur}))
fi

# list directory names when useful
if [[ ${prev} == --extend || ${prev} == --*-space ]] ; then
# add directory completion
compopt -o nospace 2>/dev/null
COMPREPLY+=($(compgen -d -S "/" -- ${cur}))
fi
;;
clean)
Expand Down

0 comments on commit fb06718

Please sign in to comment.