From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26367 invoked by alias); 2 Jun 2018 23:07:40 -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: 42919 Received: (qmail 28461 invoked by uid 1010); 2 Jun 2018 23:07:40 -0000 X-Qmail-Scanner-Diagnostics: from mail-io0-f174.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.174):SA:0(-3.6/5.0):. Processed in 0.91942 secs); 02 Jun 2018 23:07:40 -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=-3.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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=1do9VYsK8txqp4ByNWHw8UuSPh48+7NoxBho/1f/A3g=; b=hvlVxrUh0nj6omJtELyOzHagGhBT3DGZ5qPBaAN6EPU0IHMbrOsOGz02r6tQ6QfhOY RvOdqPZkX9IGgh19h2LkVAOd5u+VfcoCKGsfjqkcQN/+MSz6cZG6nbrEdbvEFnQF+I4E aiiz3DEsalSuTzxRfoBrkVzBjusGq9Vd5eVOosd62OS/rRzH+XHB3x//ck722gz58Ax8 lioFFT6TL+UnFbUKgBBJIJU2y2CxWf4t6wmXmgmRcGM+CPEL+juRLN9LuxY0FxKgQGaH FX5VNSZ4rGq0i38fiwHhXEWZ7Dg++IBPe3XSsJ6E58dDEXY/0S3qcupNAqpsSnaXWarh MO3g== 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=1do9VYsK8txqp4ByNWHw8UuSPh48+7NoxBho/1f/A3g=; b=DDDQKWRvRVzT9YWQTlrqVCqi3rJjCxZH1I8CbPctXc277MHGG4yyWMW9kZ+6S030WP BpOb+v2UNfxyVQBZ/+WRwvWp4q0l4FoWGBIQ9b/H7kIj+OW2ps3qQLXyh2Sr00mdIKxN 40AykOUnMQrr6EXnWKvVrgm5wHG/AYwa8wPJkF0+LTMlOkKsjgr0cU1+ZHS/OIkNpGa9 C2VEggBI4X6Yk52K8V9MLT408XwmXiEegvD6kc1JHwy1uoufPml4+aZI4PYyz3cejYUw EKltcyVicOO3uQdT2Y8Ae60O2QpNSCs8JpNjNDLrQ3fxh+PD0rOnFAPDkMdO7huTswcN 8R2g== X-Gm-Message-State: APt69E2FcWH9IM9sPYSUtvm+06o9CYloZffKTpmDn7DxUTH6gUNXrm6n QMJfEzbYo+UrNzrzR834Ll9poi4rWSg= X-Google-Smtp-Source: ADUXVKJCrlavlndqNn4wcEd26OlI4fyUQAuiqNAXvks9b8S2xq4C1ZQRFNOm1zB57a1kJadKrmHpbQ== X-Received: by 2002:a6b:452:: with SMTP id 79-v6mr3785572ioe.50.1527980856425; Sat, 02 Jun 2018 16:07:36 -0700 (PDT) From: dana Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [PATCH] Completion: Add _shuf, _tac, _uptime Message-Id: <873B8FFF-F1A3-4D2E-A465-8BD4042045BC@dana.is> Date: Sat, 2 Jun 2018 18:07:35 -0500 To: Zsh workers X-Mailer: Apple Mail (2.3273) Since i'm in the ML mood anyway, here are three trivial completion = functions i've had sitting in my untracked for quite a while. These relate to shuf = and tac (from GNU Coreutils), and uptime (specifically the procps and GNU = variants). I feel like i had 10 or 20 more of these to send in, but i got = discouraged, and i guess Oliver, Martin, and Jun have taken care of several of them since = then. I'll try to sort through what i had left over and submit the rest soon. dana diff --git a/Completion/Unix/Command/_shuf = b/Completion/Unix/Command/_shuf new file mode 100644 index 000000000..83f42e6d3 --- /dev/null +++ b/Completion/Unix/Command/_shuf @@ -0,0 +1,28 @@ +#compdef shuf gshuf + +local ret=3D1 +local -a context line state state_descr +local -A opt_args + +_arguments -s -S : \ + '(: -)--help[display help information]' \ + '(: -)--version[display version information]' \ + '(-n --head-count)'{-n+,--head-count=3D}'[limit output to specified = number of lines]:output line limit' \ + '(-o --output)'{-o+,--output=3D}'[write result to specified = file]:output file:_files' \ + '--random-source=3D[use specified file as source of random bytes]: = :_files' \ + '(-r --repeat)'{-r,--repeat}'[allow output lines to repeat]' \ + '(-z --zero-terminated)'{-z,--zero-terminated}'[use NUL as line = delimiter]' \ + '(-i --input-range)*: :->operands' \ + + '(excl)' \ + {-e,--echo}'[treat operands as input lines]' \ + '(:)'{-i+,--input-range=3D}'[treat specified numbers as input = lines]:number range (x-y)' \ +&& ret=3D0 + +[[ $state =3D=3D operands ]] && +if [[ -n ${opt_args[(i)excl-(-e|--echo)]} ]]; then + _message 'input line' && ret=3D0 +else + _files && ret=3D0 +fi + +return ret diff --git a/Completion/Unix/Command/_tac b/Completion/Unix/Command/_tac new file mode 100644 index 000000000..c2fbf9c6b --- /dev/null +++ b/Completion/Unix/Command/_tac @@ -0,0 +1,9 @@ +#compdef tac gtac + +_arguments -s -S : \ + '(: -)--help[display help information]' \ + '(: -)--version[display version information]' \ + '(-b --before)'{-b,--before}'[attach separator before instead of = after]' \ + '(-r --regex)'{-r,--regex}'[treat separator as regular expression = (with -s)]' \ + '(-s --separator)'{-s+,--separator=3D}'[use specified separator = instead of newline]:separator' \ + '*: :_files' diff --git a/Completion/Unix/Command/_uptime = b/Completion/Unix/Command/_uptime new file mode 100644 index 000000000..58b4d991b --- /dev/null +++ b/Completion/Unix/Command/_uptime @@ -0,0 +1,26 @@ +#compdef uptime guptime + +local variant + +_pick_variant -r variant procps=3Dprocps gnu=3D'Free Soft' unix = --version + +case $variant in + procps) + _arguments -s -S : \ + '(: -)'{-h,--help}'[display help information]' \ + '(: -)'{-V,--version}'[display version information]' \ + + '(excl)' \ + {-p,--pretty}'[display uptime in pretty format]' \ + {-s,--since}'[display date/time of system boot]' + return + ;; + gnu) + _arguments -S : \ + '(: -)--help[display help information]' \ + '(: -)--version[display version information]' \ + '1:utmp/wtmp file:_files' + return + ;; + # *BSD, Darwin, Solaris, BusyBox + *) _message 'no more arguments'; return 1 ;; +esac