From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id f9e6a78f for ; Tue, 1 Oct 2019 18:32:26 +0000 (UTC) Received: (qmail 21831 invoked by alias); 1 Oct 2019 18:32:21 -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: 44799 Received: (qmail 29978 invoked by uid 1010); 1 Oct 2019 18:32:21 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25587. spamassassin: 3.4.2. Clear:RC:0(205.235.26.22):SA:0(-1.6/5.0):. Processed in 0.7551 secs); 01 Oct 2019 18:32:21 -0000 X-Envelope-From: SRS0=xJsi=X2=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at bounces.park01.gkg.net designates 205.235.26.22 as permitted sender) X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1569954701; bh=o/0/JTIvazlGX7yGtZViuJUAnskjhCEz0FhBtOImYqw=; h=From:To:Subject:Date:From:Subject; b=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ggLMQVqYGbhrD73k_NEHNu8I eXvnuGTcNZSE4MUQzojSc.YfDj9V3qnnpzwdL4fwkOzMk8o7lswlh5NF0mselYDbtxvlfbyPvpxX AryUoG33CybQk_L3wUs3L6vUiAl5Uk50rUnvbrezzk4XLnBZk1tI2kPhUatugKLCicKK8IhLdhy7 PLn6f0HgW4x9fi5_9SlwiRGa62.37L7sTUofGm.sHYxKDf1uLCYBX8YmWXbxmM7EDCW3ZJzDB8D4 hieTbOwBcVbGhK0J1mR2_cv86XGFxiArfKeva2IpoNpBFV.wZSscz7aEG3Zy6piOf96mTPMLiVZS GfHfmjaR7L_N4nPlsHxsLbsOEjBr6Nm6q0BOMVIYC4xHX_wss1c49gOMHKjS.Bngm49pcqhRAk8G K9GFn0g9XJ1zVGTN5PcL55sirY5S2p9GMz_HrkiEMoB36oMoPgUaHNMExbIB99PJa0qxsU7tq8FM gNvBNk9IhrqDBFCd1Emgfvl52Eg_zVJKwhY74TjJUsJAVTckST1qB3saY0q9GIpSAxEBu7NLDATB UzblpYFFrUD9OevMAh__GvqN6JTsuklVxd9P.gQ_WRA-- From: Oliver Kiddle To: Zsh workers Subject: PATCH: completion for pv MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <68223.1569954698.1@hydra> Date: Tue, 01 Oct 2019 20:31:38 +0200 Message-ID: <68224-1569954698.390591@sRHa.2eRU.h_qf> New completion function for pv (pipe-viewer). Oliver diff --git a/Completion/Unix/Command/_pv b/Completion/Unix/Command/_pv new file mode 100644 index 000000000..68f8e8586 --- /dev/null +++ b/Completion/Unix/Command/_pv @@ -0,0 +1,87 @@ +#compdef pv + +local curcontext="$curcontext" ign Edesc ret=1 +local -a state state_descr line expl suf args fmts +local -A opt_args + +(( $#words > 2 )) && ign='!' +(( $+words[(r)-[^-]#E*] )) && Edesc=' and only report a read error once per file' +[[ $OSTYPE = linux* ]] && args=( + '(-d --watchfd)'{-d+,--watchfd=}'[watch file descriptor opened by process]:process\:fd:->pid-fds' \ +) + +_arguments -s -S $args \ + '(-p --progress -F --format)'{-p,--progress}'[show progress bar]' \ + '(-t --timer -F --format)'{-t,--timer}'[show elapsed time]' \ + '(-e --eta -F --format)'{-e,--eta}'[show estimated time of arrival]' \ + '(-I --fineta -F --format)'{-I,--fineta}'[show absolute estimated time of arrival]' \ + '(-r --rate -F --format)'{-r,--rate}'[show data transfer rate counter]' \ + '(-a --average-rate -F --format)'{-a,--average-rate}'[show data transfer average rate counter]' \ + '(-b --bytes -F --format)'{-b,--bytes}'[show number of bytes transferred]' \ + '(-T --buffer-percent -F --format)'{-T,--buffer-percent}'[show percentage of transfer buffer in use]' \ + '(-A --last-written -F --format)'{-A+,--last-written=}'[show number of bytes last written]:number (bytes)' \ + '(-F --format -p --progress -t --timer -e --eta -I --fineta -r --rate -a --average-rate -b --bytes -T --buffer-percent -A --last-written -F --format)'{-F+,--format=}'[set output format]:format:->formats' \ + '(-n --numeric -f --force)'{-n,--numeric}'[output percentages, not visual information]' \ + '(-q --quiet)'{-q,--quiet}"[don't output any transfer information at all, useful with -L]" \ + '(-W --wait)'{-W,--wait}'[display nothing until first byte transferred]' \ + '(-D --delay-start -R --remote)'{-D+,--delay-start=}'[display nothing until delay has passed]:delay (seconds)' \ + '(-s --size)'{-s+,--size=}'[set estimated data size]:size (bytes):->size-unit' \ + '(-l --line-mode -R --remote)'{-l,--line-mode}'[count lines instead of bytes]' \ + '(-0 --null -l --line-mode)'{-0,--null}'[lines are null-terminated]' \ + '(-i --interval)'{-i+,--interval=}'[update every after specified interval]:interval (seconds) [1]' \ + '(-w --width)'{-w+,--width}'[assume terminal is specified characters wide]:width' \ + '(-H --height)'{-H+,--height=}'[assume terminal is specified rows high]:height' \ + '(-N --name)'{-N+,--name=}'[prefix visual information with given name]:name' \ + '(-f --force -R --remote)'{-f,--force}'[output even if standard error is not a terminal]' \ + '(-c --cursor -R --remote)'{-c,--cursor}'[use cursor positioning escape sequences]' \ + '(-L --rate-limit)'{-L+,--rate-limit=}'[limit transfer rate]:rate (bytes per second):->size-unit' \ + '(-B --buffer-size)'{-B+,--buffer-size=}'[use a buffer size of given size]:size (bytes):->size-unit' \ + '(-C --no-splice)'{-C,--no-splice}'[never use splice(), always use read/write]' \ + '(-R --remote)*'{-E,--skip-errors}"[skip read errors in input${Edesc}]" \ + '(-S --stop-at-size -R --remote)'{-S,--stop-at-size}'[stop after --size bytes have been transferred]' \ + '(-R --remote -c --cursor -l --line-mode -f --force -D --delay-start -E --skip-errors -S --stop-at-size)'{-R+,--remote=}'[update settings of specified process]:process:_pids -m pv' \ + '(-P --pidfile)'{-P+,--pidfile=}'[save process id in a file]:file:_files' \ + "${ign}(- *)"{-h,--help}'[display usage information]' \ + "${ign}(- *)"{-V,--version}'[display version information]' \ + '*:file:_files' && ret=0 + +case $state in + formats) + compset -P '(%?|%<->A|[^%])#' + fmts=( + 'p:progress bar' + 't:elapsed time' + 'e:estimated time remaining' + 'I:estimated time of completion' + 'r:current data transfer rate' + 'a:average data transfer rate' + 'b:bytes transferred so far' + 'T:percentage of transfer buffer in use' + 'N:name prefix' + '%:literal %' + ) + _describe -t format-specifiers 'format specifier' fmts -p % -S '' + ;; + pid-fds) + if compset -P 1 '*:'; then + _message -e file-descriptors 'file descriptor' + else + compset -S ':*' || suf=( -qS : ) + _pids $suf && ret=0 + fi + ;; + size-unit) + if compset -P '<->'; then + _tags values units + else + _tags values + fi + while _tags; do + _requested values && _message -e values "$state_descr" && ret=0 + _requested units expl unit compadd -o nosort - K M G T && ret=0 + (( ret )) || break + done + ;; +esac + +return ret