Adding simple bash completion

This commit is contained in:
Adam Karim 2018-07-06 20:19:25 -07:00
parent 572bf8e655
commit dd2f480187
No known key found for this signature in database
GPG key ID: 230A3FA7B6D43AEB

View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
_mas()
{
local cur prev words cword;
if declare -F _init_completions >/dev/null 2>&1; then
_init_completion
else
COMPREPLY=()
_get_comp_words_by_ref cur prev words cword
fi
if [[ $cword -eq 1 ]]; then
COMPREPLY=($( compgen -W "$(mas help | tail +3 | awk '{print $1}')" -- "$cur" ));
return 0
fi
}
complete -F _mas mas