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.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,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 1ccf49ad for ; Thu, 21 Feb 2019 22:56:03 +0000 (UTC) Received: (qmail 16855 invoked by alias); 21 Feb 2019 22:55: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: 44076 Received: (qmail 23948 invoked by uid 1010); 21 Feb 2019 22:55:51 -0000 X-Qmail-Scanner-Diagnostics: from mail-it1-f194.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(209.85.166.194):SA:0(-1.9/5.0):. Processed in 0.84914 secs); 21 Feb 2019 22:55:51 -0000 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.194 as permitted sender) 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:date:references :to:in-reply-to:message-id; bh=T4bDYxhS7F4w7Xrf5+issOm3Mii9pJ6Y5783p5Z8rvk=; b=H3WUNjr/LbZIlNUi74p60BKRitZhXaDYbrEmOxmOCzMYpi8HXhhBaC61uq/K9Mai8o s8AapwL45n3/4hMAoOf0sOgjGWKw+CSilvZY4yg5zNKc+FQGUrn96c3/l3uRkdIQp0xV HxGvB2VbHMYsHKiADWwx+IPewnqNKW+8SjEaH2bh8uWUOFk+T0q6dOBZ64w8+AlawjNG +ASBc/GDeKrEVu1zc3uAogF/IILF8uHC9geut/IxGLaa9eN0pajLtJBZgPSFZD3HBxD1 YqA1ipSboIGJQlQPqrnlAz8sifhnwHr0vkYVqi80gV5yTBs0JcjYpvlLmGJueKXO2a8s 18rg== 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:date:references:to:in-reply-to:message-id; bh=T4bDYxhS7F4w7Xrf5+issOm3Mii9pJ6Y5783p5Z8rvk=; b=EZAx8Kb3BOet5vS26xtnkzpYfFM2wYgtVoPA66wSmLhMC6BoH/3w7S55inxngr76oc zxwMWa6wnWNVHOJTzu89hTa+uMHgo6upw16TTTfUqmR+Wnz3wq8+HkeOhZmc7Ejns7cD gNNeSOh+fE0rMO9xMKhvsFwzPwvFRLGdKz+cvNe3vikp+BDwbcP2AU7PzX+OFvV9WBP4 Esi/dMWfkR0r5O2r9PCs8zfuOBrPOUBeO/FKZddhH4HoJnv+35nUCiwSDiCIqOI9UnKS i3+cIQAgwl26GV5JUMhkwZBbWepbMgvrEZNgMAhAMuS39DsrOR90aQZoBj5CAIqAcQzs oL9A== X-Gm-Message-State: AHQUAuZMCaPnISFSb1deI4P+cRUDZiDqJbF0fdXWo1XOKNMj8h5E0wxX BFQcp6Le8spJureJxrFVSr2DdQl/OtpMVw== X-Google-Smtp-Source: AHgI3IZULHMUAXt1R69vt26rFdO1OdLFUN6fykBGs0rIFVQwnJJiNfLryyRcHPhL2jufGhg/6Q/U1A== X-Received: by 2002:a02:568a:: with SMTP id u10mr657725jad.130.1550789716928; Thu, 21 Feb 2019 14:55:16 -0800 (PST) From: dana Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: [PATCH] Completion: Improve _column Date: Thu, 21 Feb 2019 16:55:15 -0600 References: <4CF49770-4291-41D2-A0EA-049F623E6A26@dana.is> To: zsh workers In-Reply-To: <4CF49770-4291-41D2-A0EA-049F623E6A26@dana.is> Message-Id: <7BD6DEB6-7DDE-4D96-85A8-CC3C3DD85BC0@dana.is> X-Mailer: Apple Mail (2.3445.9.1) On 21 Feb 2019, at 16:19, dana wrote: >Some improvements to column completion: Sorry, after sending this i noticed two things: * The function was missing the options -H and -o from util-linux column; = i've added those * It wasn't right to say that util-linux `column -x` has the opposite behaviour from BSD `column -x`. It's *documented* that way, but i = think the actual behaviour is the same. The two projects might be using the word 'fill' differently. I guess i'll leave my description change, so that = it matches the documentation, but i've fixed my bogus comment dana diff --git a/Completion/Unix/Command/_column = b/Completion/Unix/Command/_column index a81684dba..55f8f66a0 100644 --- a/Completion/Unix/Command/_column +++ b/Completion/Unix/Command/_column @@ -1,33 +1,48 @@ #compdef column =20 -local ret=3D1 -local -a context state line expl args columns MATCH +local variant ret=3D1 +local -a context state line expl args columns MATCH aopts=3D( -A '-*' ) local -i MBEGIN MEND local -A opt_args =20 -case $OSTYPE in - linux-gnu) +# Debian and its derivatives (as of 2019) ship with a slightly = customised +# version of the BSD column instead of the util-linux one. It can be = identified +# by the presence of the custom option -n in the synopsis +_pick_variant -r variant \ + util-linux=3D'(#i)util-linux' \ + debian=3D'\[-[A-Za-z]#n[A-Za-z]#\]' \ + $OSTYPE \ +--version + +case $variant in + util-linux) + aopts=3D() args=3D( '(info json -c --output-width)'{-c+,--output-width=3D}'[format = output to fit display of specified width]:width' '(info)'{-L,--table-empty-lines}"[don't ignore empty lines]" + fill + # The wording here implies that this has the opposite behaviour = from BSD + # `column -x`, but it doesn't seem to. We'll keep the = descriptions + # matching the projects' respective documentation, in any case '(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 -o = --output-separator)'{-o+,--output-separator=3D}'[specify column = separator for table output]:separator [two spaces]' '(info fill -s --separator)'{-s+,--separator=3D}'[specify column = delimiters in input data]:delimiters' '(info fill -O --table-order)'{-O+,--table-order=3D}'[specify = order of output columns]: :->columns' '(info fill -N --table-columns)'{-N+,--table-columns=3D}'[specify = column names]:names' '(info fill -H --table-hide)'{-H+,--table-hide=3D}"[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-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 -H --table-hide)'{-H+,--table-hide=3D}"[don't = print specified columns]: :->columns" '(info fill json -R --table-right)'{-R+,--table-right=3D}'[right = align text in these columns]: :->columns' '(info fill json -T = --table-truncate)'{-T+,--table-truncate=3D}'[truncate text in the = columns when necessary]: :->columns' '(info fill json -W --table-wrap)'{-W+,--table-wrap=3D}'[wrap = text in the columns when necessary]: :->columns' - '(info fill json -r --tree)'{-r+,--tree=3D}'[specify column to = format tree-like]: :->column' - '(info fill json -i --tree-id)'{-i+,--tree-id=3D}'[specify column = containing ID for child-parent relations]: :->column' - '(info fill json -p --tree-parent)'{-p+,--tree-parent=3D}'[specify = column containing reference to parent]: :->column' + '(info fill json -r --tree)'{-r+,--tree=3D}'[specify column to = format tree-like]: :->columns' + '(info fill json -i --tree-id)'{-i+,--tree-id=3D}'[specify column = containing ID for child-parent relations]: :->columns' + '(info fill json -p --tree-parent)'{-p+,--tree-parent=3D}'[specify = column containing reference to parent]: :->columns' + json '(info fill text -n --table-name -c = --output-width)'{-n+,--table-name=3D}'[specify table name for JSON = output]:name' '(info fill text -J --json -c --output-width)'{-J,--json}'[use = JSON output format for table]' @@ -36,17 +51,24 @@ case $OSTYPE in '(- *)'{-V,--version}'[display version information]' ) ;; - *) + debian) + aopts=3D() args=3D( + "(-x)-n[don't merge multiple adjacent delimiters]" + "-e[don't ignore empty lines]" + ) + ;& # FALL THROUGH + *) + args+=3D( '(-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]' + '(-n -t -s)-x[fill columns before filling rows]' ) ;; esac =20 -_arguments -s -S '*:file:_files' $args && ret=3D0 +_arguments -s -S $aopts '*:file:_files' $args && ret=3D0 =20 if [[ -n $state ]]; then columns=3D( = ${(s.,.)${(Q)${opt_args[table--N]:-$opt_args[table---table-columns]}//(#m)= \\([\\:])/${MATCH[2]}}} )