Skip to content

Commit

Permalink
completion: Don't complete the complete command
Browse files Browse the repository at this point in the history
This is what we already did before the refactor with optional clap_complete.
  • Loading branch information
vincentdephily committed Mar 18, 2024
1 parent fbc09fa commit 22b67d4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 119 deletions.
79 changes: 1 addition & 78 deletions completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ _emlop() {
emlop,accuracy)
cmd="emlop__accuracy"
;;
emlop,complete)
cmd="emlop__complete"
;;
emlop,log)
cmd="emlop__log"
;;
Expand All @@ -34,7 +31,7 @@ _emlop() {

case "${cmd}" in
emlop)
opts="-f -t -H -o -F -v -h -V --from --to --header --duration --date --utc --color --output --logfile --help --version log predict stats accuracy complete"
opts="-f -t -H -o -F -v -h -V --from --to --header --duration --date --utc --color --output --logfile --help --version log predict stats accuracy"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -197,80 +194,6 @@ _emlop() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
emlop__complete)
opts="-f -t -H -o -F -v -h --shell --from --to --header --duration --date --utc --color --output --logfile --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--shell)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--from)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-f)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--to)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-t)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--header)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-H)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--duration)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--date)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--utc)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--color)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--output)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-o)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--logfile)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-F)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
emlop__log)
opts="-N -n -s -e -f -t -H -o -F -v -h --starttime --first --last --show --exact --from --to --header --duration --date --utc --color --output --logfile --help [search]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down
13 changes: 0 additions & 13 deletions completion.fish
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ complete -c emlop -n "__fish_use_subcommand" -f -a "log" -d 'Show log of sucessf
complete -c emlop -n "__fish_use_subcommand" -f -a "predict" -d 'Predict merge times for current or pretended merges'
complete -c emlop -n "__fish_use_subcommand" -f -a "stats" -d 'Show statistics about syncs, per-package (un)merges, and total (un)merges'
complete -c emlop -n "__fish_use_subcommand" -f -a "accuracy" -d 'Compare actual merge time against predicted merge time'
complete -c emlop -n "__fish_use_subcommand" -f -a "complete" -d 'Shell completion helper'
complete -c emlop -n "__fish_seen_subcommand_from log" -l starttime -d 'Display start time instead of end time' -r
complete -c emlop -n "__fish_seen_subcommand_from log" -s N -l first -d 'Show only the first <num> entries' -r
complete -c emlop -n "__fish_seen_subcommand_from log" -s n -l last -d 'Show only the last <num> entries' -r
Expand Down Expand Up @@ -82,15 +81,3 @@ complete -c emlop -n "__fish_seen_subcommand_from accuracy" -s F -l logfile -d '
complete -c emlop -n "__fish_seen_subcommand_from accuracy" -s e -l exact -d 'Match <search> using plain string'
complete -c emlop -n "__fish_seen_subcommand_from accuracy" -s v -d 'Increase verbosity (can be given multiple times)'
complete -c emlop -n "__fish_seen_subcommand_from accuracy" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c emlop -n "__fish_seen_subcommand_from complete" -l shell -d 'Write shell completion script to stdout' -r
complete -c emlop -n "__fish_seen_subcommand_from complete" -s f -l from -d 'Only parse log entries after <date>' -r
complete -c emlop -n "__fish_seen_subcommand_from complete" -s t -l to -d 'Only parse log entries before <date>' -r
complete -c emlop -n "__fish_seen_subcommand_from complete" -s H -l header -d 'Show table header' -r
complete -c emlop -n "__fish_seen_subcommand_from complete" -l duration -d 'Output durations in different formats' -r
complete -c emlop -n "__fish_seen_subcommand_from complete" -l date -d 'Output dates in different formats' -r
complete -c emlop -n "__fish_seen_subcommand_from complete" -l utc -d 'Parse/display dates in UTC instead of local time' -r
complete -c emlop -n "__fish_seen_subcommand_from complete" -l color -d 'Enable color (yes/no/auto)' -r
complete -c emlop -n "__fish_seen_subcommand_from complete" -s o -l output -d 'Ouput format (columns/tab/auto)' -r
complete -c emlop -n "__fish_seen_subcommand_from complete" -s F -l logfile -d 'Location of emerge log file' -r
complete -c emlop -n "__fish_seen_subcommand_from complete" -s v -d 'Increase verbosity (can be given multiple times)'
complete -c emlop -n "__fish_seen_subcommand_from complete" -s h -l help -d 'Print help (see more with \'--help\')'
28 changes: 0 additions & 28 deletions completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -165,28 +165,6 @@ _arguments "${_arguments_options[@]}" \
'--help[Print help (see more with '\''--help'\'')]' \
'*::search -- Show only packages/repos matching <search>:' \
&& ret=0
;;
(complete)
_arguments "${_arguments_options[@]}" \
'--shell=[Write shell completion script to stdout]: : ' \
'-f+[Only parse log entries after <date>]:date: ' \
'--from=[Only parse log entries after <date>]:date: ' \
'-t+[Only parse log entries before <date>]:date: ' \
'--to=[Only parse log entries before <date>]:date: ' \
'-H+[Show table header]' \
'--header=[Show table header]' \
'--duration=[Output durations in different formats]:format: ' \
'--date=[Output dates in different formats]:format: ' \
'--utc=[Parse/display dates in UTC instead of local time]' \
'--color=[Enable color (yes/no/auto)]' \
'-o+[Ouput format (columns/tab/auto)]:format: ' \
'--output=[Ouput format (columns/tab/auto)]:format: ' \
'-F+[Location of emerge log file]:file: ' \
'--logfile=[Location of emerge log file]:file: ' \
'*-v[Increase verbosity (can be given multiple times)]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
esac
;;
Expand All @@ -200,7 +178,6 @@ _emlop_commands() {
'predict:Predict merge times for current or pretended merges' \
'stats:Show statistics about syncs, per-package (un)merges, and total (un)merges' \
'accuracy:Compare actual merge time against predicted merge time' \
'complete:Shell completion helper' \
)
_describe -t commands 'emlop commands' commands "$@"
}
Expand All @@ -209,11 +186,6 @@ _emlop__accuracy_commands() {
local commands; commands=()
_describe -t commands 'emlop accuracy commands' commands "$@"
}
(( $+functions[_emlop__complete_commands] )) ||
_emlop__complete_commands() {
local commands; commands=()
_describe -t commands 'emlop complete commands' commands "$@"
}
(( $+functions[_emlop__log_commands] )) ||
_emlop__log_commands() {
local commands; commands=()
Expand Down

0 comments on commit 22b67d4

Please sign in to comment.