From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2119 invoked by alias); 24 Aug 2017 23:08:13 -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: X-Seq: 41598 Received: (qmail 3159 invoked by uid 1010); 24 Aug 2017 23:08:13 -0000 X-Qmail-Scanner-Diagnostics: from nm32-vm9.bullet.mail.ir2.yahoo.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(212.82.97.105):SA:0(-1.9/5.0):. Processed in 3.10487 secs); 24 Aug 2017 23:08:13 -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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: okiddle@yahoo.co.uk X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1503615632; bh=nxuKBEtOogFpHUZYQUF5llGNxU+TBwQEMFG5Jstw260=; h=From:To:Subject:Date:From:Subject; b=k5JlSLqEQ25b19B+WdF9J1ioZQuVnYmsbjEFNynkiX9QbuwOG2jMSyNQm+u2MGpWq1K3+/ojP4klVcxkCfp/7s853rgaqbGd3HwuVx/Hcn7bPqzMu75MphmhMzlbulqJs7vWHyVCtMQ6Ua36CHd3oIHaySLiciADpQbLZwF4i6h+IZZ5Cs/JU0LnMR1f3FNWNkDGLphWXuMM+nu3xeJhaI3c/J4nF8SA09LP47VPCxJwK5bPdyR1vSf+vkWVfKXUyaJfaZcmhKGtgu8rzXkQXyChLAJqA9phw89S1DSgOO2AFfjrPiDdtOzWRab3pstR/bpIimx/8U0dCBHaDLFw3Q== X-Yahoo-Newman-Id: 738448.92572.bm@smtp144.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: tdL6gbYVM1mbCdhRjMgQaEsBvMu0ZvmyR6gYOVVgI2IIgnS poUwDwGgNXqXCZ6D_pGlOEYvspHpvtJ22L9fd7AqRmoAl24_N7KdCTcTl2Ar sOSwcW8.TfaaiAf0uOEhCGu1pZFLjxc7Uf5qFnk0diQ.kXXjnkn3M7ajQ76I dcKSw57WxakCa78W0Oa05UtiQPnDM.BwWBHS4cRK8RdDZ23n.i2qLNvDd.uX LoKuxEqPN7LVXiMhxRwzSdBqFqtE7YeE4wxqMYcBn42x35Xty9EpV1sg9Nz1 NfKUdLvqajz7h5t.twywA7fKaCJvgLo7ceQUZvcXv75RwBZauw5TVMm2crTK C54UP0kNEkfQ3nmSD.0BnEsb_LPlO1Jkwfex6k8O6WKmUHes1Fu.IYGEsiR5 SnRRRHsCa.jZCcUJrtw2_Auh2lohbei_cWtpJr_mDVEWZ_RgY32Fp_IFxoF_ 2TJYwuLTdldlFvwXbMM.XYChLa3kL7wdD4pAY2WMHISVVCg-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- From: Oliver Kiddle To: Zsh workers Subject: PATCH: completion for who and w MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6459.1503615631.1@thecus.kiddle.eu> Date: Fri, 25 Aug 2017 01:00:31 +0200 Message-ID: <6460.1503615631@thecus.kiddle.eu> This adds completion for who and w. This is mainly useful because they're the sort of commands that I find myself expecting to have completions. Oliver diff --git a/Completion/Unix/Command/_w b/Completion/Unix/Command/_w new file mode 100644 index 000000000..8fb4154c7 --- /dev/null +++ b/Completion/Unix/Command/_w @@ -0,0 +1,47 @@ +#compdef w + +local args + +case $OSTYPE in + linux*) + args=( + '(H -f --from)'{-f,--from}'[toggle display of remote hostname]' + '(H -h)--no-header[suppress the heading]' + '(H -i --ip-addr)'{-i,--ip-addr}'[display IP address instead of hostname]' + '(H -o --old-style -s --short)'{-o,--old-style}'[old style output format]' + '(H -s --short -o --old-style)'{-s,--short}'[use short output format]' + '(H -u --no-current)'{-u,--no-current}'[ignore the username while figuring out the current process and cpu times]' + + H + '(-)--help[display help information]' + '(-)'{-V,--version}'[display version information]' + ) + ;; + *bsd*|darwin*|dragonfly*) + args+=( '-i[sort output by idle time]' ) + ;| + openbsd*) + args+=( '-a[translate network addresses into names]' ) + ;| + (free|net)bsd*|dragonfly*) + args+=( '-n[show network addresses as numbers]' ) + ;| + *bsd*|dragonfly*) + args+=( + '-M+[extract values from specified core]:core file:_files' + '-N+[extract name list from specified system]:system file:_files' + ) + ;| + freebsd*|dragonfly*) + args+=( '-d[dump process list on a per controlling tty basis]' ) + ;| + solaris*) + args+=( '!(-s -w -l)'{-l,-w} + '-s[short output form]' + '(-)-u[produce only the heading line]' + ) + ;| +esac + +_arguments -S -s \ + '(--no-header)-h[suppress the heading]' \ + '*:user:_users' $args diff --git a/Completion/Unix/Command/_who b/Completion/Unix/Command/_who new file mode 100644 index 000000000..1f901af18 --- /dev/null +++ b/Completion/Unix/Command/_who @@ -0,0 +1,64 @@ +#compdef who gwho + +local args variant + +_pick_variant -r variant gnu=GNU $OSTYPE --version + +case $variant in + gnu) + args=( + '(Q -a --all -b --boot -d --dead -l --login -p --process -q --count -r --runlevel -t --time -T -w --mesg --message --writable -u --users)'{-a,--all}'[same as -b -d --login -p -r -t -T -u]' + '(Q -b --boot)'{-b,--boot}'[print time of last system boot]' + '(Q -d --dead -a --all)'{-d,--dead}'[print dead processes]' + '(Q -H --heading)'{-H,--heading}'[print line of column headings]' + '(Q -l --login)'{-l,--login}'[print system login processes]' + '(Q)--lookup[canonicalize hostnames via DNS]' + '(Q)-m[print information about current terminal]' + '(Q -p --process)'{-p,--process}'[print active processes spawned by init]' + '(Q -r --runlevel)'{-r,--runlevel}'[print current runlevel]' + '(Q -t --time)'{-t,--time}'[print last system clock change]' + '(Q -T -w --mesg --message --writable)'{-T,-w,--mesg,--message,--writable}"[show user's message acceptance status as +, - or ?]" + '(Q -u --users)'{-u,--users}'[show idle time]' + '!(Q -a)-s' '!(Q -a)--short' + + Q + '(-)'{-q,--count}'[print only login names and number of users logged on]' + '(-)--help[display help information]' + '(-)--version[display version information]' + ) + ;; + darwin*|dragonfly*|netbsd*|solaris*) + args=( + '(Q -a)-d[print dead processes]' + '(Q -a)-l[print system login processes]' + '(Q -a)-p[print active processes spawned by init]' + '(Q -a)-r[print current runlevel]' + '(Q -a)-t[print last system clock change]' + ) + ;| + dragonfly*|netbsd*) + args+=( '(Q)-v[show process exit status, session id etc]' ) + ;| + (net|free)bsd*|darwin*|dragonfly*|solaris*) + args+=( + '(Q -b -d -p -r -T -u)-a[print all entries]' + '(Q -a)-b[print time of last system boot]' + '!(Q -a)-s' + ) + ;| + *) + args+=( + '(Q)-H[print line of column headings]' + '(Q)-m[print information about current terminal]' + "(Q -a)-T[show user's message acceptance status as +, - or ?]" + '(Q -a)-u[show idle time]' + + Q '(-a -b -d -H -l -m -p -r -s -t -T -v)-q[print only login names and number of users logged on]' + ) + ;| + solaris*) + args+=( + '(-a -b -d -H -l -m -p -r -s -t -T)-n+[specify number of users to list per line]:number' + ) + ;; +esac + +_arguments -s -S ':file:_files' $args