From a9386df5581487e5e34ecb3ce422bacf62d10c3d Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sun, 29 Aug 2021 17:08:34 +0200 Subject: 49319: completion options update --- Completion/Unix/Command/_less | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'Completion/Unix/Command/_less') diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less index cb71314a6..0b474b991 100644 --- a/Completion/Unix/Command/_less +++ b/Completion/Unix/Command/_less @@ -1,7 +1,7 @@ #compdef less -value-,LESS,-default- -value-,LESSCHARSET,-default- -local curcontext="$curcontext" state line expl ret=1 -local -a files +local curcontext="$curcontext" fgbg=foreground ret=1 +local -a state line expl files basic suf case $service in *LESSCHARSET*) @@ -37,15 +37,15 @@ _arguments -S -s -A "[-+]*" \ '(-b --buffers)'{-b+,--buffers=}'[specify amount of buffer space used for each file]:buffer space (kilobytes)' \ '(-B --auto-buffers)'{-B,--auto-buffers}"[don't automatically allocate buffers for pipes]" \ '(-C --CLEAR-SCREEN -c --clear-screen)'{-c,--clear-screen}'[repaint screen instead of scrolling]' \ - '(-c --clear-screen -C --CLEAR-SCREEN)'{-C,--CLEAR-SCREEN}'[clear screen before repaints]' \ + '!(-c --clear-screen)'{-C,--CLEAR-SCREEN} \ '(-d --dumb)'{-d,--dumb}'[suppress error message if terminal is dumb]' \ + '*-D+[set screen colors]: :->colors' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-e,--quit-at-eof}'[exit the second time end-of-file is reached]' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-E,--QUIT-AT-EOF}'[exit when end-of-file is reached]' \ '(-f --force)'{-f,--force}'[force opening of non-regular files]' \ '(-F --quit-if-one-screen)'{-F,--quit-if-one-screen}'[exit if entire file fits on first screen]' \ '(-G --HILITE-SEARCH -g --hilite-search)'{-g,--hilite-search}'[highlight only one match for searches]' \ '(-g --hilite-search -G --HILITE-SEARCH)'{-G,--HILITE-SEARCH}'[disable highlighting of search matches]' \ - '--old-bot[revert to the old bottom of screen behavior]' \ '(-h --max-back-scroll)'{-h+,--max-back-scroll=}'[specify backward scroll limit]:backward scroll limit (lines)' \ '(-I --IGNORE-CASE -i --ignore-case)'{-i,--ignore-case}'[ignore case in searches that lack uppercase]' \ '(-i --ignore-case -I --IGNORE-CASE)'{-I,--IGNORE-CASE}'[ignore case in all searches]' \ @@ -83,18 +83,49 @@ _arguments -S -s -A "[-+]*" \ '(-\" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \ '(-~ --tilde)'{-~,--tilde}"[don't display tildes after end of file]" \ '(-\# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \ + '--file-size[automatically determine the size of the input file]' \ + '--incsearch[search file as each pattern character is typed in]' \ + '--line-num-width=[set the width of line number field]:width [7]' \ '--follow-name[the F command changes file if the input file is renamed]' \ '--mouse[enable mouse input]' \ '--no-histdups[remove duplicates from command history]' \ '--rscroll=[set the character used to mark truncated lines]:character [>]' \ '--save-marks[retain marks across invocations of less]' \ + '--status-col-width=[set the width of the -J status column]:width [2]' \ '--use-backslash[subsequent options use backslash as escape char]' \ + '--use-color[enable colored text]' \ '--wheel-lines=[specify lines to move for each click of the mouse wheel]:lines' \ "$files[@]" && ret=0 if [[ -n "$state" ]]; then case $state in + colors) + if compset -P 1 \?; then + [[ $IPREFIX[-1] != [a-z] ]] || compset -P 1 + || _describe 'color application' '( +:add\ to\ existing\ attribute )' + suf=( -S '' ) + compset -P 1 '([a-zA-Z]|*.)' && fgbg=background && suf=() + basic=( B:blue C:cyan G:green K:black M:magenta R:red W:white Y:yellow ) + _describe -t colors "$fgbg color" \ + "( -:default ${(j. .)${(@)basic/:/:light\ }} ${(Lj. .)basic} )" "$suf[@]" && ret=0 + else + _describe 'text' '( + B:binary\ characters + C:control\ characters + E:errors\ and\ informational\ messages + M:mark\ letters\ in\ the\ status\ column + N:line\ numbers\ enabled\ via\ the\ -N\ option + P:prompts + R:the\ rscroll\ character + S:search\ results + W:the\ highlight\ enabled\ via\ the\ -w\ option + d:bold\ text + k:blinking\ text + s:standout\ text + u:underlined\ text + )' -S '' && ret=0 + fi + ;; prompts) if compset -p 1; then _message -e prompt -- cgit v1.2.3 From 4e9d0075f438c4404b29ad6901f6ed6aa4d0fdc6 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 26 Oct 2021 18:35:36 +0200 Subject: 49519: quote completed options as needed and remove the now superfluous quotes from option specifications --- ChangeLog | 9 ++++++++- Completion/Base/Utility/_arguments | 10 +++++----- Completion/Darwin/Command/_qtplay | 2 +- Completion/Unix/Command/_less | 4 ++-- Completion/Unix/Command/_nm | 2 +- Completion/Unix/Command/_php | 2 +- Completion/Unix/Command/_strings | 2 +- Completion/Unix/Command/_zip | 2 +- Completion/X/Command/_gnome-gv | 2 +- 9 files changed, 21 insertions(+), 14 deletions(-) (limited to 'Completion/Unix/Command/_less') diff --git a/ChangeLog b/ChangeLog index abdab0ffe..ff8a738c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2021-10-26 Oliver Kiddle + * 49519: Completion/Base/Utility/_arguments, + Completion/Darwin/Command/_qtplay, Completion/Unix/Command/_less, + Completion/Unix/Command/_nm, Completion/Unix/Command/_php, + Completion/Unix/Command/_strings, Completion/Unix/Command/_zip, + Completion/X/Command/_gnome-gv: quote completed options as needed + and remove the now superfluous quotes from option specifications + * 49516: Src/Zle/compmatch.c: bail out early from matching control if command line content is too short for the coanchor @@ -12,7 +19,7 @@ 2021-10-23 Oliver Kiddle - * 49499 based on 49496 by Jun T.: Src/Zle/computil.c + * 49499 based on 49496 by Jun T.: Src/Zle/computil.c, Test/Y03arguments.ztst: fixes to option -A of _arguments * 49500: Completion/Linux/Command/_lsns: new completion diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments index cab7c929e..5ff34ff47 100644 --- a/Completion/Base/Utility/_arguments +++ b/Completion/Base/Utility/_arguments @@ -513,8 +513,8 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" ) _describe -O option \ - tmp1 tmp2 -Q -S '' -- \ - tmp3 -Q + tmp1 tmp2 -S '' -- \ + tmp3 [[ -n "$optarg" && "$single" = next && nm -eq $compstate[nmatches] ]] && _all_labels options expl option \ @@ -525,9 +525,9 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then else next+=( "$odirect[@]" ) _describe -O option \ - next -Q -M "$matcher" -- \ - direct -QS '' -M "$matcher" -- \ - equal -QqS= -M "$matcher" + next -M "$matcher" -- \ + direct -S '' -M "$matcher" -- \ + equal -qS= -M "$matcher" fi PREFIX="$prevpre" IPREFIX="$previpre" diff --git a/Completion/Darwin/Command/_qtplay b/Completion/Darwin/Command/_qtplay index 39a7c6de2..839efee83 100644 --- a/Completion/Darwin/Command/_qtplay +++ b/Completion/Darwin/Command/_qtplay @@ -15,6 +15,6 @@ _arguments -S \ '-t[specify update time]:update time (seconds)' \ '-T[kill time]:ticks' \ '-V[volume]:percentage of normal volume' \ - '(-)'{-?,--help,-h}'[display help information]' \ + '(-)'{-\?,--help,-h}'[display help information]' \ '(-)*:quicktime file:_files' diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less index 0b474b991..ae912a633 100644 --- a/Completion/Unix/Command/_less +++ b/Completion/Unix/Command/_less @@ -80,9 +80,9 @@ _arguments -S -s -A "[-+]*" \ '--no-keypad[disable use of keypad terminal init string]' \ '(-y --max-forw-scroll)'{-y,--max-forw-scroll}'[specify forward scroll limit]' \ '(-z --window)'{-z+,--window=}'[specify scrolling window size]:lines' \ - '(-\" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \ + '(-" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \ '(-~ --tilde)'{-~,--tilde}"[don't display tildes after end of file]" \ - '(-\# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \ + '(-# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \ '--file-size[automatically determine the size of the input file]' \ '--incsearch[search file as each pattern character is typed in]' \ '--line-num-width=[set the width of line number field]:width [7]' \ diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm index 79f537ac6..888f1ef87 100644 --- a/Completion/Unix/Command/_nm +++ b/Completion/Unix/Command/_nm @@ -53,7 +53,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu '(-C)--demangle[decode symbol names]' '(--format -P)-f+[specify output format]:format:(bsd sysv posix)' '(- *)--usage[give a short usage message]' - '(- *)-\\?[display help information]' + '(- *)-?[display help information]' ) ;; binutils) diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php index c4c4ab3e2..9a8f519b1 100644 --- a/Completion/Unix/Command/_php +++ b/Completion/Unix/Command/_php @@ -93,7 +93,7 @@ _php() { + '(hv)' # Help/version options; kept separate by convention '(- 1 *)'{-h,--help}'[display help information]' '(- 1 *)'{-v,--version}'[display version information]' - '!(- 1 *)'{-\?,-\\\?,--usage} + '!(- 1 *)'{-\?,--usage} + '(im)' # Info/module options (exclusive with everything but -c/-n) '(fi mc pb pf rf rn sc sv *)'{-i,--info}'[display configuration information (phpinfo())]' diff --git a/Completion/Unix/Command/_strings b/Completion/Unix/Command/_strings index af95af52f..685daa286 100644 --- a/Completion/Unix/Command/_strings +++ b/Completion/Unix/Command/_strings @@ -45,7 +45,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu elfutils) args+=( '(- *)--usage[display a short usage message]' - '(- *)-\\?[display help information]' + '(- *)-?[display help information]' ) ;; esac diff --git a/Completion/Unix/Command/_zip b/Completion/Unix/Command/_zip index bc9aab1a5..cfa51be36 100644 --- a/Completion/Unix/Command/_zip +++ b/Completion/Unix/Command/_zip @@ -115,7 +115,7 @@ case $service in '(-U)-UU[ignore any Unicode fields]' \ '-W[modify pattern matching so only ** matches /]' \ '-\:[allow extraction outside of extraction base directory]' \ - '-\\\^[allow control characters in extracted entries]' \ + '-^[allow control characters in extracted entries]' \ '-i[include the following names]:*-*:pattern' \ '-x[exclude the following names]:*-*:pattern' \ "(-p -f -u -l -t -z -n -o -j -C -X -q -qq -a -aa -v -L -M)1:zip file:_files -g '(#i)*.(zip|xpi|[ejw]ar)(-.)'" \ diff --git a/Completion/X/Command/_gnome-gv b/Completion/X/Command/_gnome-gv index 25de6fadf..b1b66e2a4 100644 --- a/Completion/X/Command/_gnome-gv +++ b/Completion/X/Command/_gnome-gv @@ -1,6 +1,6 @@ #compdef gnome-gv ggv _arguments \ - '(--help)-\\?[help]' \ + '(--help)-?[help]' \ '(--windows)-w[number of empty windows]:number:' \ '*:file: _pspdf -z' -- -- cgit v1.2.3 From a692b980cb895143e073ac2e3fccf5ad0760eafe Mon Sep 17 00:00:00 2001 From: Jun-ichi Takimoto Date: Wed, 23 Feb 2022 11:24:39 +0900 Subject: 49765: _less: add option --color as synonym for -D --- ChangeLog | 5 +++++ Completion/Unix/Command/_less | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_less') diff --git a/ChangeLog b/ChangeLog index 5dc07937f..f8e82282a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2022-02-23 Jun-ichi Takimoto + + * 49765: Completion/Unix/Command/_less: add option --color + as synonym for -D + 2022-02-22 Daniel Shahaf * unposted: Doc/Zsh/contrib.yo, Src/Modules/parameter.c, diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less index ae912a633..0a72782ef 100644 --- a/Completion/Unix/Command/_less +++ b/Completion/Unix/Command/_less @@ -39,7 +39,7 @@ _arguments -S -s -A "[-+]*" \ '(-C --CLEAR-SCREEN -c --clear-screen)'{-c,--clear-screen}'[repaint screen instead of scrolling]' \ '!(-c --clear-screen)'{-C,--CLEAR-SCREEN} \ '(-d --dumb)'{-d,--dumb}'[suppress error message if terminal is dumb]' \ - '*-D+[set screen colors]: :->colors' \ + '*'{-D+,--color=}'[set screen colors]: :->colors' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-e,--quit-at-eof}'[exit the second time end-of-file is reached]' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-E,--QUIT-AT-EOF}'[exit when end-of-file is reached]' \ '(-f --force)'{-f,--force}'[force opening of non-regular files]' \ @@ -104,7 +104,7 @@ if [[ -n "$state" ]]; then if compset -P 1 \?; then [[ $IPREFIX[-1] != [a-z] ]] || compset -P 1 + || _describe 'color application' '( +:add\ to\ existing\ attribute )' suf=( -S '' ) - compset -P 1 '([a-zA-Z]|*.)' && fgbg=background && suf=() + compset -P 1 '([-a-zA-Z]|*.)' && fgbg=background && suf=() basic=( B:blue C:cyan G:green K:black M:magenta R:red W:white Y:yellow ) _describe -t colors "$fgbg color" \ "( -:default ${(j. .)${(@)basic/:/:light\ }} ${(Lj. .)basic} )" "$suf[@]" && ret=0 -- cgit v1.2.3 From ef60187efce77c0572daf419ca5ba57a28df3cad Mon Sep 17 00:00:00 2001 From: Jun-ichi Takimoto Date: Wed, 23 Feb 2022 11:39:33 +0900 Subject: 49766: _less: add quotes to -" and -# --- ChangeLog | 2 ++ Completion/Unix/Command/_less | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_less') diff --git a/ChangeLog b/ChangeLog index f8e82282a..ca8477dfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2022-02-23 Jun-ichi Takimoto + * 49766: Completion/Unix/Command/_less: add quotes to -" and -# + * 49765: Completion/Unix/Command/_less: add option --color as synonym for -D diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less index 0a72782ef..69f75fd0e 100644 --- a/Completion/Unix/Command/_less +++ b/Completion/Unix/Command/_less @@ -80,9 +80,9 @@ _arguments -S -s -A "[-+]*" \ '--no-keypad[disable use of keypad terminal init string]' \ '(-y --max-forw-scroll)'{-y,--max-forw-scroll}'[specify forward scroll limit]' \ '(-z --window)'{-z+,--window=}'[specify scrolling window size]:lines' \ - '(-" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \ + '(-\" --quotes)'{'-\"+',--quotes=}'[change quoting character]:quoting characters' \ '(-~ --tilde)'{-~,--tilde}"[don't display tildes after end of file]" \ - '(-# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \ + '(-\# --shift)'{'-\#+',--shift=}"[specify amount to move when scrolling horizontally]:number" \ '--file-size[automatically determine the size of the input file]' \ '--incsearch[search file as each pattern character is typed in]' \ '--line-num-width=[set the width of line number field]:width [7]' \ -- cgit v1.2.3