From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24848 invoked by alias); 9 Jun 2018 05:16:06 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42965 Received: (qmail 27321 invoked by uid 1010); 9 Jun 2018 05:16:06 -0000 X-Qmail-Scanner-Diagnostics: from mail-io0-f171.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.223.171):SA:0(-1.9/5.0):. Processed in 3.501503 secs); 09 Jun 2018 05:16:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_PASS,T_DKIMWL_WL_MED,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=exRCJ3fM4J85b7FDwTQMnzISIPCepxoi29UvwD4cof4=; b=APaD++mo0z/Mb4wbyYd3n4D6PAOg1PS5WWoL+By281jZYiqBT1+47NrUqU9IsAUkLy Ubh8vkZVszBfMl45EusHIurPOMWhfeSgeOoXzPE6891AxKEl9UVwjhFzjYNlLsyTA4+i xAaSIPAwGEOkJlp9iRndncX7Y9jicpKkQ0p7EL94rBxjemW1gfvBzUvmBY3L2Gi1J6hA SkTLr61ZnxE6hWPGgOUzix4fm9kQxC1KIgCIWocqqYKvTlRsBuhRPFomRfUk5BbKbWaj NykkKHVdtanBU0BA5hNwSIZJZvOxqAAkTR0RPdArLmOhz/pRyk0LuWVHVH3O0SUki/fR zexg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=exRCJ3fM4J85b7FDwTQMnzISIPCepxoi29UvwD4cof4=; b=TZdghV3u5Gxsv3Ik1qx7pRkxfpj7oMgkSrw5bfBrYl5kOrJDbO0itjySv7l7F74wiC bF5aci6NierxwSEKYppshiivOXRiSoL2PZsFbbu/9OKbc1WdLH1f84eSBh3zR4G680oN hqwlONMqrk67Duusl/a1tGJYmhH2eZAyNLcjpS9qTMGgySte2Mcq3+b5OHG6PG1XzonX QdZ3kjZ3D8YhYzmWKkFXAMLeoAKeXq39mhh2cxJDBnP2KC0JA35fyolb04IRVRbXKooW W7x1610rilIHapC40z7UbRspEXXzVkgv460stv5ypFo7c4OjWCwyJoPh7G3oUiPcPebp TXgQ== X-Gm-Message-State: APt69E15qNGIZEq9nWjJfP5/Pucz7VBXykQL3djsuLyUSXFxJxacdkX3 HLfootKIe9GV9ASQDvr2JXZ9l4KBdqg= X-Google-Smtp-Source: ADUXVKLcpH3z2uNGqF8exKJyEHv0JTblqzElStjv3Xw5L3CIZ4P9TTq8KTrcz6L3haZANPMOjwn5QA== X-Received: by 2002:a6b:8b91:: with SMTP id n139-v6mr7416845iod.109.1528521360332; Fri, 08 Jun 2018 22:16:00 -0700 (PDT) From: dana Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [PATCH] Completion: Add _bash, update _sh Message-Id: <52421D97-B114-45A1-B547-30F4D6DAE162@dana.is> Date: Sat, 9 Jun 2018 00:15:59 -0500 To: Zsh workers X-Mailer: Apple Mail (2.3273) This adds full completion for bash. Hopefully that's not heresy or = something. It also updates _sh to stop completing for bash (of course), and to = start completing for ash, dash, yash, and a few others that were missing. PS: I find zsh's own completion function a bit underwhelming. It's a = good demo of `_arguments --`, but zsh has so many options, and the --help output = is so non-descriptive about them, that relying on that just doesn't feel very = nice somehow. I'd like to improve it, but the only way i can think to achieve = that is to manually enumerate each shell option (180 of them!) and their variant = name(s) (482 total!). That's certainly doable, but idk, not sure if it's the = right direction. PPS: I think workers # 42918 was missed: http://www.zsh.org/mla/workers/2018/msg00722.html dana diff --git a/Completion/Unix/Command/_bash = b/Completion/Unix/Command/_bash new file mode 100644 index 000000000..260ca64fb --- /dev/null +++ b/Completion/Unix/Command/_bash @@ -0,0 +1,85 @@ +#compdef bash + +local ret=3D1 +local -a context line state state_descr args tmp cmd +local -A opt_args val_args + +cmd=3D( $words[1] --noprofile --norc ) + +args=3D( + # Long options must appear before short options (take care =E2=80=94 = some of these are + # duplicated in the s group below!) + + l + '!--debug' + '--debugger[enable extended debugging mode]' + '(-D --dump-po-strings --dump-strings)--dump-po-strings[like -D, but = display in gettext PO format]' + '(-D --dump-po-strings --dump-strings)--dump-strings[display strings = subject to language translation]' + '(: -)--help[display help information]' + # The usual =3D is deliberately omitted here + '(--init-file --rcfile)'{--init-file,--rcfile}'[load specified file = instead of ~/.bashrc]: :_files' + '(-l --login)--login[act as login shell]' + '--noediting[disable readline editing]' + '--noprofile[do not load /etc/profile, ~/.bash_profile, etc.]' + '--norc[do not load ~/.bashrc]' + '--posix[enable POSIX mode]' + '(-r --restricted)--restricted[act as restricted shell]' + '(: -)--version[display version information]' + # This is ugly, but this way the + variants have accurate = descriptions. Note + # that bash does accept + variants of -i, -l, -s, etc., but they = don't seem to + # actually do anything, so we don't bother with them + + s + '(l)'{'-a[','+a[do not '}'mark all functions and variables for = export]' + '(l)'{'-B[','+B[do not '}'enable brace expansion]' + '(l)'{'-b[','+b[do not '}'report status of terminated background jobs = immediately]' + '(l)'{'-C[','+C[do not '}'prevent output redirection from overwriting = existing files]' + '(l 1 -)-c[execute specified command string]:command = string:_cmdstring:argv[0]:' + '(l)-D[display strings subject to language translation]' + '(l)'{'-E[','+E[do not '}'make functions and subshells inherit ERR = traps]' + '(l)'{'-e[','+e[do not '}'exit immediately on non-zero return]' + '(l)'{'-f[','+f[do not '}'disable file globbing]' + '(l)'{'-H[','+H[do not '}'enable history substitution]' + '(l)'{'-h[','+h[do not '}'hash commands]' + '(l)-i[act as interactive shell]' + '(l)'{'-k[','+k[do not '}'act on variable assignments in command = arguments]' + '(l)-l[act as login shell]' + '(l)'{'-m[','+m[do not '}'enable job control]' + '(l)'{'-n[','+n[do not '}'read (syntax-check) commands only]' + '(l)*'{'-O[','+O[un'}'set specified `shopt` option]: = :->shopt-options' + '(l)*'{'-o[','+o[un'}'set specified `set` option]: :->set-options' + '(l)'{'-P[','+P[do not '}'resolve cd paths]' + '(l)'{'-p[','+p[do not '}'enable privileged mode]' + '(l)-r[act as restricted shell]' + '(l 1 -c)-s[read commands from standard input]' + '(l)'{'-T[','+T[do not '}'make functions and subshells inherit DEBUG = and RETURN traps]' + '(l)'{'-t[','+t[do not '}'exit after executing one command]' + '(l)'{'-u[','+u[do not '}'treat unset variables as an error during = parameter expansion]' + '(l)'{'-v[','+v[do not '}'print shell input lines as they are read]' + '(l)'{'-x[','+x[do not '}'print command trace]' + + o + '(-)1:script file:_files' + '(-)*:: :->args' +) + +_arguments -s -S -A '-*' : $args && ret=3D0 + +case $state in + args) + if [[ -n ${opt_args[(i)s--[cs]]} ]]; then + _files && ret=3D0 + else + _normal && ret=3D0 + fi + ;; + set-options) + tmp=3D( ${(f)"$( _call_program set-options ${(q-)cmd} -c '"shopt = -o"' )"} ) + tmp=3D( ${tmp%%[[:space:]]*} ) + _values -w '`set` option' $tmp && ret=3D0 + ;; + shopt-options) + tmp=3D( ${(f)"$( _call_program shopt-options ${(q-)cmd} -c shopt = )"} ) + tmp=3D( ${tmp%%[[:space:]]*} ) + _values -w '`shopt` option' $tmp && ret=3D0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_sh b/Completion/Unix/Command/_sh index 2afb46621..39d299c58 100644 --- a/Completion/Unix/Command/_sh +++ b/Completion/Unix/Command/_sh @@ -1,4 +1,4 @@ -#compdef sh ksh bash csh tcsh rc +#compdef sh ash csh dash ksh ksh88 ksh93 mksh oksh pdksh rc tcsh yash =20 if (( CURRENT =3D=3D ${words[(i)-c]} + 1 )); then _cmdstring