* [PATCH 1/6] Update head completion
2023-08-02 6:21 [PATCH 0/6] Update coreutils command completions Shohei YOSHIDA
@ 2023-08-02 6:21 ` Shohei YOSHIDA
2023-08-02 6:21 ` [PATCH 2/6] Update date completion Shohei YOSHIDA
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Shohei YOSHIDA @ 2023-08-02 6:21 UTC (permalink / raw)
To: zsh-workers; +Cc: Shohei YOSHIDA
Support -z, --zero-terminated flags
---
Completion/Unix/Command/_head | 1 +
1 file changed, 1 insertion(+)
diff --git a/Completion/Unix/Command/_head b/Completion/Unix/Command/_head
index 0771b1e4d..8877600f6 100644
--- a/Completion/Unix/Command/_head
+++ b/Completion/Unix/Command/_head
@@ -9,6 +9,7 @@ if _pick_variant gnu=GNU unix --version; then
'(-n --lines -c --bytes)'{-n+,--lines=}'[print the first (or with -, all but the last) specified lines]:number of lines:->number'
'(-q --quiet --silent -v --verbose)'{-q,--quiet,--silent}'[never print headers giving file names]'
'(-q --quiet --silent -v --verbose)'{-v,--verbose}'[always print headers giving file names]'
+ '(-z --zero-terminated)'{-z,--zero-terminated}'[line delimiter is NUL, not newline]'
'(- *)--help[display help and exit]'
'(- *)--version[output version information and exit]'
)
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/6] Update date completion
2023-08-02 6:21 [PATCH 0/6] Update coreutils command completions Shohei YOSHIDA
2023-08-02 6:21 ` [PATCH 1/6] Update head completion Shohei YOSHIDA
@ 2023-08-02 6:21 ` Shohei YOSHIDA
2023-08-02 6:21 ` [PATCH 3/6] Update env completion Shohei YOSHIDA
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Shohei YOSHIDA @ 2023-08-02 6:21 UTC (permalink / raw)
To: zsh-workers; +Cc: Shohei YOSHIDA
Support --resolution flag for GNU date
---
Completion/Unix/Command/_date | 1 +
1 file changed, 1 insertion(+)
diff --git a/Completion/Unix/Command/_date b/Completion/Unix/Command/_date
index 97c272830..6be34ffcd 100644
--- a/Completion/Unix/Command/_date
+++ b/Completion/Unix/Command/_date
@@ -19,6 +19,7 @@ if _pick_variant gnu="Free Software Foundation" unix --version; then
$f{-R,--rfc-email}'[display in RFC5322 format]'
$f'--rfc-3339=-[display in RFC 3339 format]:precision:(date seconds ns)'
'(-u --utc --universal)'{-u,--utc,--universal}'[display or set time in UTC]'
+ '--resolution[output the available resolution of timestamps]'
'(- :)--help[output help and exit]'
'(- :)--version[output version info and exit]'
)
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/6] Update env completion
2023-08-02 6:21 [PATCH 0/6] Update coreutils command completions Shohei YOSHIDA
2023-08-02 6:21 ` [PATCH 1/6] Update head completion Shohei YOSHIDA
2023-08-02 6:21 ` [PATCH 2/6] Update date completion Shohei YOSHIDA
@ 2023-08-02 6:21 ` Shohei YOSHIDA
2023-08-02 6:21 ` [PATCH 4/6] Update tail completion Shohei YOSHIDA
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Shohei YOSHIDA @ 2023-08-02 6:21 UTC (permalink / raw)
To: zsh-workers; +Cc: Shohei YOSHIDA
Support -0, --null flags
---
Completion/Unix/Command/_env | 1 +
1 file changed, 1 insertion(+)
diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env
index a5dd49d37..f7283e132 100644
--- a/Completion/Unix/Command/_env
+++ b/Completion/Unix/Command/_env
@@ -9,6 +9,7 @@ case $variant in
(( $#words > 2 )) && ign='!'
args=(
'(-)'{-i,--ignore-environment}'[start with empty environment]'
+ '(-0 --null)'{-0,--null}'[end each output line with NUL, not newline]'
'(--ignore-environment -i --help --version)*'{-u+,--unset=}'[remove variable from the environment]:env var to remove:_parameters -g "*export*"'
'(-C --chdir)'{-C+,--chdir=}'[change working directory]:directory:_directories'
'(-S --split-string)'{-S+,--split-string=}'[perform word splitting]:string to split'
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/6] Update tail completion
2023-08-02 6:21 [PATCH 0/6] Update coreutils command completions Shohei YOSHIDA
` (2 preceding siblings ...)
2023-08-02 6:21 ` [PATCH 3/6] Update env completion Shohei YOSHIDA
@ 2023-08-02 6:21 ` Shohei YOSHIDA
2023-08-02 6:21 ` [PATCH 5/6] Update tr completion Shohei YOSHIDA
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Shohei YOSHIDA @ 2023-08-02 6:21 UTC (permalink / raw)
To: zsh-workers; +Cc: Shohei YOSHIDA
Support -z, --zero-terminated flags
---
Completion/Unix/Command/_tail | 1 +
1 file changed, 1 insertion(+)
diff --git a/Completion/Unix/Command/_tail b/Completion/Unix/Command/_tail
index e54a0b06e..f8006abbc 100644
--- a/Completion/Unix/Command/_tail
+++ b/Completion/Unix/Command/_tail
@@ -16,6 +16,7 @@ if _pick_variant gnu=GNU unix --version; then
'(-q --quiet --silent -v --verbose)'{-q,--quiet,--silent}'[never output headers giving file names]'
'(-q --quiet --silent -v --verbose)'{-v,--verbose}'[always output headers giving file names]'
'--retry[keep trying to open a file even when it becomes inaccessible]'
+ '(-z --zero-terminated)'{-z,--zero-terminated}'[line delimiter is NUL, not newline]'
'(- *)--help[display help and exit]'
'(- *)--version[output version information and exit]'
)
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/6] Update tr completion
2023-08-02 6:21 [PATCH 0/6] Update coreutils command completions Shohei YOSHIDA
` (3 preceding siblings ...)
2023-08-02 6:21 ` [PATCH 4/6] Update tail completion Shohei YOSHIDA
@ 2023-08-02 6:21 ` Shohei YOSHIDA
2023-08-02 6:21 ` [PATCH 6/6] Update wc completion Shohei YOSHIDA
2023-08-06 20:26 ` [PATCH 0/6] Update coreutils command completions Bart Schaefer
6 siblings, 0 replies; 10+ messages in thread
From: Shohei YOSHIDA @ 2023-08-02 6:21 UTC (permalink / raw)
To: zsh-workers; +Cc: Shohei YOSHIDA
Support -t, --truncate-set1 flags
---
Completion/Unix/Command/_tr | 1 +
1 file changed, 1 insertion(+)
diff --git a/Completion/Unix/Command/_tr b/Completion/Unix/Command/_tr
index 1cfe1200a..6d899431c 100644
--- a/Completion/Unix/Command/_tr
+++ b/Completion/Unix/Command/_tr
@@ -16,6 +16,7 @@ case $variant in
'(-c -C --complement)'{-c,-C,--complement}"${descr[-c]}"
'(-d --delete 2)'{-d,--delete}"${descr[-d]}"
'(-s --squeeze-repeats)'{-s,--squeeze-repeats}"${descr[-s]}"
+ '(-t --truncate-set1)'{-t,--truncate-set1}'[first truncate ARRAY1 to length of ARRAY2]'
'(- 1 2)--help[display help information]'
'(- 1 2)--version[display version information]'
)
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6/6] Update wc completion
2023-08-02 6:21 [PATCH 0/6] Update coreutils command completions Shohei YOSHIDA
` (4 preceding siblings ...)
2023-08-02 6:21 ` [PATCH 5/6] Update tr completion Shohei YOSHIDA
@ 2023-08-02 6:21 ` Shohei YOSHIDA
2023-08-06 20:26 ` [PATCH 0/6] Update coreutils command completions Bart Schaefer
6 siblings, 0 replies; 10+ messages in thread
From: Shohei YOSHIDA @ 2023-08-02 6:21 UTC (permalink / raw)
To: zsh-workers; +Cc: Shohei YOSHIDA
Support --total flag
---
Completion/Unix/Command/_wc | 1 +
1 file changed, 1 insertion(+)
diff --git a/Completion/Unix/Command/_wc b/Completion/Unix/Command/_wc
index 49a03ba2c..a1897e289 100644
--- a/Completion/Unix/Command/_wc
+++ b/Completion/Unix/Command/_wc
@@ -13,6 +13,7 @@ if _pick_variant gnu=GNU unix --version; then
args+=(
'(*)--files0-from=[read NUL-terminated file list from specified file]:file:_files'
'(-L --max-line-length)'{-L,--max-line-length}'[print longest line lengths]'
+ '--total=[when to print a line with total counts]:when:(auto always only never)'
)
else
args=( -A "-*" "${(@)args:#(|\(*\))(|\*)--*}" )
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/6] Update coreutils command completions
2023-08-02 6:21 [PATCH 0/6] Update coreutils command completions Shohei YOSHIDA
` (5 preceding siblings ...)
2023-08-02 6:21 ` [PATCH 6/6] Update wc completion Shohei YOSHIDA
@ 2023-08-06 20:26 ` Bart Schaefer
2023-08-09 14:09 ` Jun. T
6 siblings, 1 reply; 10+ messages in thread
From: Bart Schaefer @ 2023-08-06 20:26 UTC (permalink / raw)
To: zsh-workers
I've been taking it upon myself to track and commit Yoshida's
completion patches when time permits, but i'm giving them only a
superficial review -- if someone who is more familiar with the
implementations he's patching would like to step in, please do.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/6] Update coreutils command completions
2023-08-06 20:26 ` [PATCH 0/6] Update coreutils command completions Bart Schaefer
@ 2023-08-09 14:09 ` Jun. T
2023-11-01 0:12 ` Oliver Kiddle
0 siblings, 1 reply; 10+ messages in thread
From: Jun. T @ 2023-08-09 14:09 UTC (permalink / raw)
To: zsh-workers
> 2023/08/07 5:26、Bart Schaefer <schaefer@brasslantern.com>のメール:
>
> if someone who is more familiar with the
> implementations he's patching would like to step in, please do.
The second hunks in the patches for _env and _watch below are (possible)
fix for a problem that existed before his patch.
_env and _watch call _normal to complete a command and args, but since
they are passed to execve() or 'sh -c', it would make no sense to complete
zsh bultins or functions etc. I replaced
_normal
by
_normal -p env/watch
so that only external commands are offered. Is this a correct use of the
option -p?
Other hunks are just minor fixes.
Completion/Unix/Command/_date | 2 +-
Completion/Unix/Command/_env | 4 ++--
Completion/Unix/Command/_watch | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Completion/Unix/Command/_date b/Completion/Unix/Command/_date
index 6be34ffcd..9add1a9bc 100644
--- a/Completion/Unix/Command/_date
+++ b/Completion/Unix/Command/_date
@@ -19,7 +19,7 @@ if _pick_variant gnu="Free Software Foundation" unix --version; then
$f{-R,--rfc-email}'[display in RFC5322 format]'
$f'--rfc-3339=-[display in RFC 3339 format]:precision:(date seconds ns)'
'(-u --utc --universal)'{-u,--utc,--universal}'[display or set time in UTC]'
- '--resolution[output the available resolution of timestamps]'
+ $d'--resolution[output the available resolution of timestamps]'
'(- :)--help[output help and exit]'
'(- :)--version[output version info and exit]'
)
diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env
index f7283e132..bdab71bbe 100644
--- a/Completion/Unix/Command/_env
+++ b/Completion/Unix/Command/_env
@@ -9,7 +9,7 @@ case $variant in
(( $#words > 2 )) && ign='!'
args=(
'(-)'{-i,--ignore-environment}'[start with empty environment]'
- '(-0 --null)'{-0,--null}'[end each output line with NUL, not newline]'
+ '(* -0 --null)'{-0,--null}'[end each output line with NUL, not newline]'
'(--ignore-environment -i --help --version)*'{-u+,--unset=}'[remove variable from the environment]:env var to remove:_parameters -g "*export*"'
'(-C --chdir)'{-C+,--chdir=}'[change working directory]:directory:_directories'
'(-S --split-string)'{-S+,--split-string=}'[perform word splitting]:string to split'
@@ -59,7 +59,7 @@ if [[ -n $state ]]; then
shift words
(( CURRENT-- ))
done
- _normal && ret=0
+ _normal -p env && ret=0
;;
user-class)
if compset -P 1 '*/'; then
diff --git a/Completion/Unix/Command/_watch b/Completion/Unix/Command/_watch
index 91244abe7..e12add520 100644
--- a/Completion/Unix/Command/_watch
+++ b/Completion/Unix/Command/_watch
@@ -18,7 +18,7 @@ case $variant in
'(-g --chgexit)'{-g,--chgexit}'[exit on command output change]' \
'(-n --interval)'{-n+,--interval=}'[specify update interval]:update interval (seconds) [2]' \
'(-p --precise)'{-p,--precise}'[run command at precise intervals]' \
- '(-q --equexit)'{-q,--equexit}'[exit when output of command does not change for the given cycles]:cycles' \
+ '(-q --equexit)'{-q+,--equexit=}'[exit when output of command does not change for the given cycles]:cycles' \
'(-r --no-rerun)'{-r,--no-rerun}'[do not run the program on terminal resize]' \
'(-t --no-title)'{-t,--no-title}'[disable header]' \
'(-w --no-wrap)'{-w,--no-wrap}'[disable line wrapping]' \
@@ -34,7 +34,7 @@ case $variant in
then
_cmdstring && ret=0
else
- _normal && ret=0
+ _normal -p watch && ret=0
fi
;;
# watch(1) has completely different semantics on freebsd compared to linux, hence:
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/6] Update coreutils command completions
2023-08-09 14:09 ` Jun. T
@ 2023-11-01 0:12 ` Oliver Kiddle
0 siblings, 0 replies; 10+ messages in thread
From: Oliver Kiddle @ 2023-11-01 0:12 UTC (permalink / raw)
To: Jun. T; +Cc: zsh-workers
On 9 Aug, "Jun. T" wrote:
> The second hunks in the patches for _env and _watch below are (possible)
> fix for a problem that existed before his patch.
> _env and _watch call _normal to complete a command and args, but since
> they are passed to execve() or 'sh -c', it would make no sense to complete
> zsh bultins or functions etc. I replaced
> _normal
> by
> _normal -p env/watch
> so that only external commands are offered. Is this a correct use of the
> option -p?
This breaks env completion. It was relying on _normal to complete
environment variables which is fairly fundamental to the use of env.
This use of _normal is fairly new. There probably is a need for a
simple way to get _normal without builtins, aliases, functions etc.
This mechanism with -p seems to have resulted from quite a number of
separate patches, each of which seemed very reasonable when taken alone
but the end effect doesn't really seem ideal. Tracking precommands
could be useful for things like noglob but isn't really for things like
env and watch. So it is being used for things that aren't conventional
precommands to get the effect of external commands only. Every use of
-p is passed $service - if that will always be the case, why require
it. I think I'd prefer a more explicit option to _normal - -e perhaps
for external commands (as for _command_names) and perhaps -E to allow
variable assignments.
In many cases, we're actually relying on later fallbacks to _default for
completing values. _default only does this for magicequalsubst so if you
unset that option, variable value completion for commands like env is
broken. _normal (or _command_names) should be doing this explicitly.
Oliver
^ permalink raw reply [flat|nested] 10+ messages in thread