Skip to content

Commit

Permalink
feat: add autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
strdr4605 committed Mar 10, 2022
1 parent d9c1413 commit 67b2d2d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,20 @@ tt() {
_options "$1" "$2"
fi
}

# Autocomplete
# taken https://askubuntu.com/questions/68175/how-to-create-script-with-auto-complete
_tt()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="--help --start --pause --done --finish --abort --clear-logs --activity-name --logs"

if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _tt tt

0 comments on commit 67b2d2d

Please # to comment.