From e626f57613ad2dacd7fe7244f6a33de5c8f03f9e Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sun, 19 Jan 2020 21:31:56 +0000 Subject: 45332: _git: add completion for git-version Signed-off-by: Eitan Adler --- Completion/Unix/Command/_git | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 7f2c206c1..ba1852699 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -407,6 +407,12 @@ _git-bundle () { return ret } +(( $+functions[_git-version] )) || +_git-version () { + _arguments -S $endopt \ + '--build-options[also print build options]' +} + (( $+functions[_git-check-ignore] )) || _git-check-ignore () { _arguments -s -S $endopt \ @@ -5951,7 +5957,8 @@ _git_commands () { show-branch:'show branches and their commits' verify-commit:'check GPG signature of commits' verify-tag:'check GPG signature of tags' - whatchanged:'show commit-logs and differences they introduce') + whatchanged:'show commit-logs and differences they introduce' + version:'show git version') interaction_commands=( archimport:'import an Arch repository into git' -- cgit 1.4.1 From e71ba9704f86a4a3ec1f0ddabbb1f2296fe421fe Mon Sep 17 00:00:00 2001 From: WGH Date: Sun, 2 Feb 2020 07:31:36 +0000 Subject: 45365: _git: Fix __git_recent_branches for the case when a commit has an empty message --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 95a94db07..698e21592 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-02-02 WGH + + * 45365: Completion/Unix/Command/_git: Fix __git_recent_branches + for the case when a commit has an empty message + 2020-01-29 Daniel Shahaf * 45343: Src/exec.c, Src/math.c: Queue signals around arithmetic diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index ba1852699..97ab26512 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6662,8 +6662,8 @@ __git_recent_branches() { # 4. Obtain log messages for all of them in one shot. # TODO: we'd really like --sort=none here... but git doesn't support such a thing. - # The \n removal is because for-each-ref prints a \n after each entry. - descriptions=( ${(0)"$(_call_program all-descriptions "git --no-pager for-each-ref --format='%(refname)%00%(subject)%00'" refs/heads/${(q)^branches} "--")"//$'\n'} ) + local z=$'\0' + descriptions=( "${(0)"$(_call_program all-descriptions "git --no-pager for-each-ref --format='%(refname)%00%(subject)'" refs/heads/${(q)^branches} "--")"//$'\n'/$z}" ) # 5. Synthesize the data structure _describe wants. local -a branches_colon_descriptions -- cgit 1.4.1 From 1f238665f6a4f9fce9232d305a95c58f13ed0c5a Mon Sep 17 00:00:00 2001 From: Martin von Wittich Date: Thu, 6 Feb 2020 13:24:00 -0600 Subject: _diff_options: Restore -w completion lost in workers/43351 --- ChangeLog | 6 ++++++ Completion/Unix/Type/_diff_options | 1 + 2 files changed, 7 insertions(+) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 2b0d1d4de..0116724b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-02-06 dana + + * Martin von Wittich: 45388 (tweaked): + Completion/Unix/Type/_diff_options: Restore -w completion lost + in workers/43351 + 2020-02-03 Daniel Shahaf * 45368: Test/B01cd.ztst, Test/D02glob.ztst: Add tests for diff --git a/Completion/Unix/Type/_diff_options b/Completion/Unix/Type/_diff_options index 4fd27442e..440913dff 100644 --- a/Completion/Unix/Type/_diff_options +++ b/Completion/Unix/Type/_diff_options @@ -92,6 +92,7 @@ if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12-> '--ignore-file-name-case[ignore case when comparing file names]' \ '!(--ignore-file-name-case)--no-ignore-file-name-case' \ '(-b --ignore-space-change)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ + '(-w --ignore-all-space)'{-w,--ignore-all-space}'[ignore all white space]' \ '(-B --ignore-blank-lines)'{-B,--ignore-blank-lines}'[ignore lines that are all blank]' \ '(-I --ignore-matching-lines)'{-I+,--ignore-matching-lines=}'[ignore lines that match regex]:line exclusion regex:' \ '--strip-trailing-cr[strip trailing carriage return on input]' \ -- cgit 1.4.1 From 8037462895b4de98528a6b56c2f35d606150d3f3 Mon Sep 17 00:00:00 2001 From: dana Date: Fri, 7 Feb 2020 14:05:48 -0600 Subject: unposted: _zip: Recognise '--' --- ChangeLog | 4 ++++ Completion/Unix/Command/_zip | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index ea80ad5bc..b71c1bd8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2020-02-07 dana + + * unposted: Completion/Unix/Command/_zip: Recognise '--' + 2020-02-06 Daniel Shahaf * 45385: Test/V01zmodload.ztst: Add a test for 'zmodload -Fa' diff --git a/Completion/Unix/Command/_zip b/Completion/Unix/Command/_zip index 1b1b6c315..bc9aab1a5 100644 --- a/Completion/Unix/Command/_zip +++ b/Completion/Unix/Command/_zip @@ -82,7 +82,7 @@ case $service in '*:file:->files' && ret=0 ;; unzip) - _arguments -C -s \ + _arguments -C -s -S \ '(-Z)-M[page output]' \ - unzip \ '(-f -u -l -t -z -d -p)-c[extract files to stdout including file names]' \ @@ -130,7 +130,7 @@ esac [[ $state == zipinfo ]] && uzi="-Z[zipinfo mode]" if [[ $service == zipinfo ]] || [[ -n $uzi ]]; then - _arguments -C -s \ + _arguments -C -s -S \ $uzi \ '(-2 -s -m -l -v -h -t -T -z)-1[filenames only]' \ '(-1 -s -m -l -v -T)-2[just filenames but allow -h/-t/-z]' \ @@ -170,7 +170,7 @@ case $state in fi 2>/dev/null if [[ $zipfile != $_zip_cache_name ]]; then _zip_cache_name="$zipfile" - _zip_cache_list=( ${(f)"$(zipinfo -1 $_zip_cache_name)"} ) + _zip_cache_list=( ${(f)"$(zipinfo -1 -- $_zip_cache_name)"} ) fi _wanted files expl 'file from archive' \ _multi_parts / _zip_cache_list && return -- cgit 1.4.1 From dd523255cc67780f2e073136d7f44978f96534a7 Mon Sep 17 00:00:00 2001 From: dana Date: Fri, 14 Feb 2020 09:42:12 -0600 Subject: 45423: _su: Improve arg handling, shell look-ups Differences from ML post: * Properly fix escaping issue with $usr (needs unescaped first) * Make $shell emptiness check easier to read (per feedback) --- ChangeLog | 5 +++++ Completion/Unix/Command/_su | 45 +++++++++++++++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 12 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index b71c1bd8c..f23a956b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-02-14 dana + + * 45423 (tweaked): Completion/Unix/Command/_su: Improve arg + handling, shell look-ups + 2020-02-07 dana * unposted: Completion/Unix/Command/_zip: Recognise '--' diff --git a/Completion/Unix/Command/_su b/Completion/Unix/Command/_su index 900905632..032f867f4 100644 --- a/Completion/Unix/Command/_su +++ b/Completion/Unix/Command/_su @@ -9,36 +9,44 @@ local shell usr (( $words[(i)-(l|-login)] < CURRENT )) || args=( '-[use a login shell]' ) case $OSTYPE in linux*) + # Some of these options only apply to util-linux, not shadow-utils args=( -S $args - '(-c --command --session-command *)'{-c,--command=}'[pass command to shell]:command string:_cmdstring' + '(-c --command --session-command *)'{-c+,--command=}'[pass command to shell]:command string:_cmdstring' "(-c --command *)--session-command=[pass command to shell and don't create a new session]:command string:_cmdstring" '(--fast -f)'{-f,--fast}'[pass -f to shell]' '(-l --login -m -p --preserve-environment)'{-l,--login}'[use a login shell]' '(-l --login -m -p --preserve-environment)'{-m,-p,--preserve-environment}"[don't reset environment]" - '(-s --shell)'{-s,--shell=}'[run the specified shell]:shell:->shells' + '(-s --shell)'{-s+,--shell=}'[run the specified shell]:shell:->shells' '(-)--help[display help information]' '(-)--version[display version information]' ) - (( EUID )) || args+=( - '(-g --group)'{-g,--group=}'[specify primary group]:group:_groups' - \*{-G,--supp-group=}'[specify supplemental group]:group:_groups' + (( $#_comp_priv_prefix || EUID == 0 )) && args+=( + '(-g --group)'{-g+,--group=}'[specify primary group]:group:_groups' + \*{-G+,--supp-group=}'[specify supplemental group]:group:_groups' ) first="(--help --version)${first#???}" ;; *bsd*|darwin*|dragonfly*) args+=( - '-c[use settings from specified login class]:class' '-f[if the invoked shell is csh, prevent it from reading .cshrc]' '(-m)-l[use a login shell]' "(-l)-m[don't reset environment]" ) ;| + *bsd*|dragonfly*) + args+=( + '-c+[use settings from specified login class]:class' + ) + ;| freebsd*) args+=( '-s[set the MAC label]' ) ;; openbsd*) args+=( - '(-K)-a[specify authentication type]:authentication type' + # See login.conf(5) + '(-K)-a+[specify authentication type]:authentication type:( + activ chpass crypto lchpass passwd radius reject skey snk token yubikey + )' '(-a)-K[shorthand for -a passwd]' - '-s[run the specified shell]:shell:->shells' + '-s+[run the specified shell]:shell:->shells' '-L[loop until login succeeds]' ) ;; @@ -57,13 +65,26 @@ fi _arguments $args ${(e)first} "*:shell arguments:= ->rest" && return -usr=${line[norm]/--/root} -if (( $#opt_args[(i)-(s|-shell)] )); then +usr=${${(Q)line[norm]}/--/root} +# OpenBSD supports appending a log-in method to the user name, as in usr:radius +[[ $OSTYPE == openbsd* ]] && usr=${usr%:*} + +# Normal users generally don't appear in passwd on macOS; try the Directory +# Service first +if [[ $OSTYPE == darwin* ]] && (( $+commands[dscl] )); then + shell=${"$( + _call_program shells dscl . -read /Users/${(q)usr} UserShell + )"#UserShell: } +fi + +if [[ -n $shell ]]; then + : # Found above +elif (( ${#${(@M)args:#*-s[+\[]*:*}} && $#opt_args[(i)-(s|-shell)] )); then shell=${(v)opt_args[(i)-(s|-shell)]} elif (( ${+commands[getent]} )); then - shell="${$(_call_program shells getent passwd $usr)##*:}" + shell="${$(_call_program shells getent passwd ${(q)usr})##*:}" else - shell="${${(M@)${(@f)$(