Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add completions files #40

Merged
merged 2 commits into from
Sep 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
✨ Add completions files
  • Loading branch information
uzimaru0000 committed Sep 12, 2021
commit e9932a8460fc5b4ed3815df31e74012b04213e8a
49 changes: 49 additions & 0 deletions completions/bash/tv.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
_tv() {
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
tv)
cmd="tv"
;;

*)
;;
esac
done

case "${cmd}" in
tv)
opts=" -h -V -r -s -a --help --version --recursive --sort --align --style <PATH>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--style)
COMPREPLY=($(compgen -W "ascii sharp rounded markdown plane" -- "${cur}"))
return 0
;;

--align)
COMPREPLY=($(compgen -W "left center right" -- "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;

esac
}

complete -F _tv -o bashdefault -o default tv
7 changes: 7 additions & 0 deletions completions/fish/tv.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
complete -c tv -l style -d 'Table style' -r -f -a "ascii sharp rounded markdown plane"
complete -c tv -s a -l align -d 'Table alignment' -r -f -a "left center right"
complete -c tv -s s -l sort -d 'Options for sorting by key' -r -f
complete -c tv -l no-headers -d 'Specify that the input has no header row'
complete -c tv -s r -l recursive -d 'Recursive display'
complete -c tv -n "__fish_use_subcommand" -s h -l help -d 'Prints help information'
complete -c tv -n "__fish_use_subcommand" -s V -l version -d 'Prints version information'
30 changes: 30 additions & 0 deletions completions/zsh/_tv
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#compdef tv

autoload -U is-at-least

_tv() {
typeset -a _arguments_options

if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi

_arguments "${_arguments_options[@]}" \
'-a+[Table alignment]' \
'--align=[Table alignment]: :(left center right)' \
'--style=[Specify the border style]: :(ascii sharp rounded larkdown)' \
'-s+[Options for sorting by key]' \
'--sort=[Options for sorting by key]' \
'-r[Recursive display]' \
'--recursive[Recursive display]' \
'--no-headers[Specify that the input has no header row]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::FILE -- json file path:_files' \
}

compdef _tv tv