From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19144 invoked by alias); 5 Apr 2018 02:17:51 -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: 42583 Received: (qmail 10120 invoked by uid 1010); 5 Apr 2018 02:17:51 -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.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(205.235.26.22):SA:0(0.2/5.0):. Processed in 26.848546 secs); 05 Apr 2018 02:17:51 -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=0.2 required=5.0 tests=BAYES_00,DATE_IN_PAST_03_06, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS,T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=fJi4=G2=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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=1522894257; bh=MQukExTKNsTzI6cpCjwjwzpAjHMwo3LAQ8tIx9wtxBI=; h=From:To:Subject:Date:From:Subject; b=D/K/stWKmaHrn27/VHnpSEcWLYmi4pQG15QYMrsrISnzY8uXFLa8A7Z8yePBwTZuKrVEKPGxNNhtci+dRCZcssBuEJC8r9m3VdoWLKdohj4Xw0nN1o+TX/Os1YCIbZlKfuXffQNLXOLB0+YtoOZutgoVWXQT2ZG3A95bge5snpyxqkkHsYbhBKnNPm804zxB9/2tV4GPQCxrt9BJm8tHCebpBAi1KN55JQoqBVKqFrBeO9adQD+/JrVMNIolO/7pnUPJs4FMp6C48h4tbq4nozk4BdVMyvrX2PyO2gbr6YlMZKWkQRw+G855hUFz5bjuY/cQSpkpL2LidoC/eLEsXw== X-YMail-OSG: JYCsZM4VM1kRtIs2_FIydgI7b7Qup9B5Es9.yF_4lY7OB_PNysXy43B5zwQ.kAj H_W6.offhA722C8lDb0ploHO8MlXi.K8.ioXAoNy7qPf_oBnt1ay.KFL.qzPY2af9OvNXH7QeYiT Z.wIbVWjYx6IGUNIj4hLIK46ydsZ3l2jfPmpOgJBA.OhxnNL3usq_Gc4p6GD9QKa7t5uJT8L7Ac8 _J5MH_FERMabmdVlmQCZApCpO7qvjtOGb_pNz2gfBJZO51xr32TVgReL6beVLntSm5Xodj3zut_h Cy30UsLBd7OioKwuUW2N5LCIC07Dnap0kHTLdR8cjcAOL7lD5OPYnDHkJPRLq37.dGWSdHlL5BWs 7M7_kwJa7xS424qoyPfu.B.U01CgUQTpPl_UKstdPF1u6qq5vRxiRd3D4vQ7ek3WK_14vMlL32tI XAZG8CwblryWnzpiSZGvA5gRALBeP66iat9rVHGXVpEnJGZQuX1aqMwSrYa942zon_afjzmCQWHc ixi2dlILkdQ-- From: Oliver Kiddle To: Zsh workers Subject: PATCH: new column completion MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24372.1522881335.1@thecus> Date: Thu, 05 Apr 2018 00:35:35 +0200 Message-ID: <24373.1522881335@thecus> Having been unchanged for years, the util-linux column command has gained quite a bit of new functionality recently. This now adds completion for it. Oliver diff --git a/Completion/Unix/Command/_column b/Completion/Unix/Command/_column new file mode 100644 index 000000000..cb67fef37 --- /dev/null +++ b/Completion/Unix/Command/_column @@ -0,0 +1,59 @@ +#compdef column + +local ret=1 +local -a context state line expl args columns MATCH +local -i MBEGIN MEND +local -A opt_args + +case $OSTYPE in + linux-gnu) + args=( + '(info json -c --output-width)'{-c+,--output-width=}'[format output to fit display of specified width]:width' + + fill + '(info table text json -x --fillrows)'{-x,--fillrows}'[fill rows before filling columns]' + + table + '(info fill -t --table)'{-t,--table}'[create a table]' + '(info fill -s --separator)'{-s+,--separator=}'[specify column delimiters in input data]:delimiters' + '(info fill -O --table-order)'{-O+,--table-order=}'[specify order of output columns]: :->columns' + '(info fill -N --table-columns)'{-N+,--table-columns=}'[specify column names]:names' + '(info fill -H --table-hide)'{-H+,--table-hide=}"[don't print specified columns]: :->columns" + + text + '(info fill json -d --table-noheadings)'{-d,--table-noheadings}"[don't print header]" + '(info fill json -E --table-noextreme)'{-E,--table-noextreme}"[specify columns where length can be ignored]: :->columns" + '(info fill json -e --table-header-repeat)'{-e,--table-header-repeat}'[repeat header for each page]' + '(info fill json -R --table-right)'{-R+,--table-right=}'[right align text in these columns]: :->columns' + '(info fill json -T --table-truncate)'{-T+,--table-truncate=}'[truncate text in the columns when necessary]: :->columns' + '(info fill json -W --table-wrap)'{-W+,--table-wrap=}'[wrap text in the columns when necessary]: :->columns' + '(info fill json -r --tree)'{-r+,--tree=}'[specify column to format tree-like]: :->column' + '(info fill json -i --tree-id)'{-i+,--tree-id=}'[specify column containing ID for child-parent relations]: :->column' + '(info fill json -p --tree-parent)'{-p+,--tree-parent=}'[specify column containing reference to parent]: :->column' + + json + '(info fill text -n --table-name -c --output-width)'{-n+,--table-name=}'[specify table name for JSON output]:name' + '(info fill text -J --json -c --output-width)'{-J,--json}'[use JSON output format for table]' + + info + '(- *)'{-h,--help}'[display usage information]' + '(- *)'{-V,--version}'[display version information]' + ) + ;; + *) + args=( + '(-t -s)-c+[format output to fit display of specified width]:width' + '(-c -x)-t[create a table]' + '(-c -x)-s+[specify column delimiters in input data]:delimiters' + '(-t -s)-x[fill rows before filling columns]' + ) + ;; +esac + +_arguments -s -S '*:file:_files' $args && ret=0 + +if [[ -n $state ]]; then + columns=( ${(s.,.)${(Q)${opt_args[table--N]:-$opt_args[table---table-columns]}//(#m)\\([\\:])/${MATCH[2]}}} ) + if (( $#columns )); then + ${${(M)state:#*s}:+_sequence} _wanted -C "$context[1]" columns expl column compadd -a - columns && ret=0 + else + _message -e columns "$state" + fi +fi + +return ret