Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions bin/completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

function _nrun_completion() {
local cur tasks
cur=${COMP_WORDS[COMP_CWORD]}
_get_comp_words_by_ref -n : cur
# The sed command strips terminal escape sequences.
tasks=$(nrun | grep '^ [a-zA-Z0-9]*$' | awk '{print $1}')
if [ $COMP_CWORD -eq 1 ]; then
tasks=$(nrun | grep '^ [a-zA-Z0-9:-]*$' | awk '{print $1}')
if [[ $COMP_LINE =~ ^${COMP_WORDS[0]}\ [^\ ]+\ ]]; then
COMPREPLY=( $(compgen -f "$cur") )
else
# Task name completion for first argument.
COMPREPLY=( $(compgen -W "$tasks" "$cur") )
else
# File name completion for other arguments.
COMPREPLY=( $(compgen -f "$cur") )
__ltrim_colon_completions "$cur"
fi
}
complete -F _nrun_completion nrun
Expand Down