From 22b67d4242c0c0bdc7a2d00e723c47b4450a1060 Mon Sep 17 00:00:00 2001 From: Vincent de Phily Date: Mon, 18 Mar 2024 00:12:53 +0000 Subject: [PATCH] completion: Don't complete the complete command This is what we already did before the refactor with optional clap_complete. --- completion.bash | 79 +------------------------------------------------ completion.fish | 13 -------- completion.zsh | 28 ------------------ 3 files changed, 1 insertion(+), 119 deletions(-) diff --git a/completion.bash b/completion.bash index 0f5b6b4..af5a039 100644 --- a/completion.bash +++ b/completion.bash @@ -15,9 +15,6 @@ _emlop() { emlop,accuracy) cmd="emlop__accuracy" ;; - emlop,complete) - cmd="emlop__complete" - ;; emlop,log) cmd="emlop__log" ;; @@ -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 @@ -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 diff --git a/completion.fish b/completion.fish index c7c9c3b..af04fae 100644 --- a/completion.fish +++ b/completion.fish @@ -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 entries' -r complete -c emlop -n "__fish_seen_subcommand_from log" -s n -l last -d 'Show only the last entries' -r @@ -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 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 ' -r -complete -c emlop -n "__fish_seen_subcommand_from complete" -s t -l to -d 'Only parse log entries before ' -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\')' diff --git a/completion.zsh b/completion.zsh index 2c59125..9498803 100644 --- a/completion.zsh +++ b/completion.zsh @@ -165,28 +165,6 @@ _arguments "${_arguments_options[@]}" \ '--help[Print help (see more with '\''--help'\'')]' \ '*::search -- Show only packages/repos matching :' \ && ret=0 -;; -(complete) -_arguments "${_arguments_options[@]}" \ -'--shell=[Write shell completion script to stdout]: : ' \ -'-f+[Only parse log entries after ]:date: ' \ -'--from=[Only parse log entries after ]:date: ' \ -'-t+[Only parse log entries before ]:date: ' \ -'--to=[Only parse log entries before ]: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 ;; @@ -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 "$@" } @@ -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=()