2020-01-15 01:20:38 -08:00
|
|
|
_just() {
|
|
|
|
local i cur prev opts cmds
|
|
|
|
COMPREPLY=()
|
|
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
cmd=""
|
|
|
|
opts=""
|
|
|
|
|
|
|
|
for i in ${COMP_WORDS[@]}
|
|
|
|
do
|
|
|
|
case "${i}" in
|
|
|
|
just)
|
|
|
|
cmd="just"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
case "${cmd}" in
|
|
|
|
just)
|
2020-09-17 19:43:04 -07:00
|
|
|
opts=" -q -u -v -e -l -h -V -f -d -s --dry-run --highlight --no-dotenv --no-highlight --quiet --clear-shell-args --unsorted --verbose --choose --dump --edit --evaluate --init --list --summary --variables --help --version --chooser --color --justfile --set --shell --shell-arg --working-directory --completions --show <ARGUMENTS>... "
|
2020-10-05 17:58:30 -07:00
|
|
|
if [[ ${cur} == -* ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
elif [[ ${COMP_CWORD} -eq 1 ]]; then
|
|
|
|
local recipes=$(just --summary --color never 2> /dev/null)
|
|
|
|
if [[ $? -eq 0 ]]; then
|
|
|
|
COMPREPLY=( $(compgen -W "${recipes}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
2020-01-15 01:20:38 -08:00
|
|
|
case "${prev}" in
|
|
|
|
|
2020-09-17 19:43:04 -07:00
|
|
|
--chooser)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2020-01-15 01:20:38 -08:00
|
|
|
--color)
|
|
|
|
COMPREPLY=($(compgen -W "auto always never" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--justfile)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-f)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--set)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--shell)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--shell-arg)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--working-directory)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-d)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--completions)
|
|
|
|
COMPREPLY=($(compgen -W "zsh bash fish powershell elvish" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--show)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-s)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
COMPREPLY=()
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _just -o bashdefault -o default just
|