Update dotfiles/.local/share/bash-completion/generate.sh, dotfiles/.local/share/bash-completion/completions/hyperfine.bash

This commit is contained in:
Brian Zalewski 2022-11-22 13:12:56 +00:00
parent ebd428d4be
commit 6db6386c4f
2 changed files with 181 additions and 2 deletions

View file

@ -0,0 +1,174 @@
_hyperfine() {
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
"$1")
cmd="hyperfine"
;;
*)
;;
esac
done
case "${cmd}" in
hyperfine)
opts="-h -V -w -m -M -r -s -p -c -P -D -L -S -N -i -u -n --help --version --warmup --min-runs --max-runs --runs --setup --prepare --cleanup --parameter-scan --parameter-step-size --parameter-list --style --shell --ignore-failure --time-unit --export-asciidoc --export-csv --export-json --export-markdown --export-orgmode --show-output --output --command-name --min-benchmarking-time --debug-mode <command>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--warmup)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-w)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--min-runs)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-m)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--max-runs)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-M)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--runs)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-r)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--setup)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-s)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--prepare)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-p)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--cleanup)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--parameter-scan)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-P)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--parameter-step-size)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-D)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--parameter-list)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-L)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--style)
COMPREPLY=($(compgen -W "auto basic full nocolor color none" -- "${cur}"))
return 0
;;
--shell)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-S)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--time-unit)
COMPREPLY=($(compgen -W "millisecond second" -- "${cur}"))
return 0
;;
-u)
COMPREPLY=($(compgen -W "millisecond second" -- "${cur}"))
return 0
;;
--export-asciidoc)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--export-csv)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--export-json)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--export-markdown)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--export-orgmode)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--output)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--command-name)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-n)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--min-benchmarking-time)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _hyperfine -o bashdefault -o default hyperfine

View file

@ -1,5 +1,8 @@
#!/usr/bin/env bash
### Initialize
mkdir -p "$HOME/.local/share/bash-completion/completions"
### Deno
if command -v deno > /dev/null; then
deno completions bash > "$HOME/.local/share/bash-completion/completions/deno.bash"
@ -53,8 +56,10 @@ if command -v helm > /dev/null; then
fi
### Hyperfine
if command -v hyperfine > /dev/null && [ -f /usr/local/src/hyperfine/autocomplete/hyperfine.bash-completion ]; then
cp /usr/local/src/hyperfine/autocomplete/hyperfine.bash-completion "$HOME/.local/share/bash-completion/completions/hyperfine.bash"
if command -v hyperfine > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix hyperfine)/etc/bash_completion.d/hyperfine.bash" ]; then
cp "$(brew --prefix hyperfine)/etc/bash_completion.d/hyperfine.bash" "$HOME/.local/share/bash-completion/completions/hyperfine.bash"
elif command -v hyperfine > /dev/null; then
fi
### kubectl