2020-01-15 12:20:38 +03: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
|
2021-12-02 06:38:57 +03:00
|
|
|
"$1")
|
2020-01-15 12:20:38 +03:00
|
|
|
cmd="just"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
case "${cmd}" in
|
|
|
|
just)
|
2024-01-09 11:40:08 +03:00
|
|
|
opts=" -n -q -u -v -e -l -h -V -f -d -c -s --check --yes --dry-run --highlight --no-deps --no-dotenv --no-highlight --quiet --shell-command --clear-shell-args --unsorted --unstable --verbose --changelog --choose --dump --edit --evaluate --fmt --init --list --summary --variables --help --version --chooser --color --command-color --dump-format --list-heading --list-prefix --justfile --set --shell --shell-arg --working-directory --command --completions --show --dotenv-filename --dotenv-path <ARGUMENTS>... "
|
2020-10-06 03:58:30 +03:00
|
|
|
if [[ ${cur} == -* ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
elif [[ ${COMP_CWORD} -eq 1 ]]; then
|
2022-09-24 06:34:55 +03:00
|
|
|
local recipes=$(just --summary 2> /dev/null)
|
|
|
|
|
2023-06-18 03:05:49 +03:00
|
|
|
if echo "${cur}" | \grep -qF '/'; then
|
2022-09-24 06:34:55 +03:00
|
|
|
local path_prefix=$(echo "${cur}" | sed 's/[/][^/]*$/\//')
|
|
|
|
local recipes=$(just --summary 2> /dev/null -- "${path_prefix}")
|
|
|
|
local recipes=$(printf "${path_prefix}%s\t" $recipes)
|
|
|
|
fi
|
|
|
|
|
2020-10-06 03:58:30 +03:00
|
|
|
if [[ $? -eq 0 ]]; then
|
|
|
|
COMPREPLY=( $(compgen -W "${recipes}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
2020-01-15 12:20:38 +03:00
|
|
|
case "${prev}" in
|
|
|
|
|
2020-09-18 05:43:04 +03:00
|
|
|
--chooser)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2020-01-15 12:20:38 +03:00
|
|
|
--color)
|
|
|
|
COMPREPLY=($(compgen -W "auto always never" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2023-10-11 03:04:34 +03:00
|
|
|
--command-color)
|
|
|
|
COMPREPLY=($(compgen -W "black blue cyan green purple red yellow" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2021-11-17 11:07:48 +03:00
|
|
|
--dump-format)
|
|
|
|
COMPREPLY=($(compgen -W "just json" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2021-02-09 12:00:04 +03:00
|
|
|
--list-heading)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--list-prefix)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2020-01-15 12:20:38 +03:00
|
|
|
--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
|
|
|
|
;;
|
2021-05-10 06:35:35 +03:00
|
|
|
--command)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-c)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2020-01-15 12:20:38 +03:00
|
|
|
--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
|
|
|
|
;;
|
2021-08-09 08:37:35 +03:00
|
|
|
--dotenv-filename)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--dotenv-path)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2020-01-15 12:20:38 +03:00
|
|
|
*)
|
|
|
|
COMPREPLY=()
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _just -o bashdefault -o default just
|