zsh-workers
 help / color / mirror / code / Atom feed
From: Clint Adams <schizo@debian.org>
To: zsh-workers@sunsite.dk
Cc: "Dr. Markus Waldeck" <waldeck@gmx.de>, 448465@bugs.debian.org
Subject: Re: Bug#448465: zsh completion for coreutils cut
Date: Mon, 29 Oct 2007 09:56:38 -0400	[thread overview]
Message-ID: <20071029135638.GA27117@scowler.net> (raw)

On Mon, Oct 29, 2007 at 10:39:44AM +0100, Dr. Markus Waldeck wrote:
> Is there a design decision to handle i18n?
> 
> I checked all existing completion files but I did not find any hint!

As far as I know, you're the first one to try it; there's not even any
i18n in the main shell.

> #compdef cut
> 
> local _cut_args
> 
> declare -A _cut_args
> 
> case $LANG in
>   de_DE.UTF-8)
>      _cut_args=(
>            bytes           "nur diese Bytes ausgeben" 
>            characters      "nur diese Zeichen ausgeben" 
>            delimiter       "Delimiter anstelle von Tabulator als Trenner benutzen"
>            fields          "nur diese Felder und alle Zeilen OHNE Trennzeichen ausgeben"
>            n               "(ignoriert)"
>            complement      "das Komplement der Menge der gewählten Bytes, Zeichen oder Felder bilden"
>            only-delimited  "keine Zeilen ausgeben, die keinen Trenner enthalten"
>            ouput-delimiter "Zeichenkette als Ausgabetrennzeichen benutzen"
>            help            "diese Hilfe anzeigen und beenden"
>            version         "Versionsinformation anzeigen und beenden"
>      )
>   ;;
>   *)
>      _cut_args=(
>            bytes           "select only these bytes"
>            characters      "select only these characters"
>            delimiter       "use DELIM instead of TAB for field delimiter"
>            fields          "select only these fields and lines whitout the delimiter character"
>            n               "(ignored)"
>            complement      "complement the set of selected bytes, characters or fields"
>            only-delimited  "do not print lines not containing delimiters"
>            ouput-delimiter "use STRING as the output delimiter"
>            help            "display this help and exit"
>            version         "output version information and exit"
>      )
>   ;;
> esac
> 
> _arguments \
>         '(--bytes -b)'{--bytes=,-b}'['$_cut_args[bytes]']' \
>         '(--characters -c)'{--characters=,-c}'['$_cut_args[characters]']' \
>         '(--delimiter -d)'{--delimiter=,-d}'['$_cut_args[delimiter]']' \
>         '(--fields -f)'{--fields=,-f}'['$_cut_args[fields]']' \
>         '-n['$_cut_args[n]']' \
>         '--complement['$_cut_args[complement]']' \
>         '(--only-delimited -s)'{--only-delimited=,-s}'['$_cut_args[only-delimited]']' \
>         '--ouput-delimiter['$_cut_args[ouput-delimiter]']' \
>         '--help['$_cut_args[help]']' \
>         '--version['$_cut_args[version]']' \

A couple tweaks; the "local" was redundant and "output" was misspelled a
few times.

Index: Completion/Unix/Command/_cut
===================================================================
RCS file: Completion/Unix/Command/_cut
diff -N Completion/Unix/Command/_cut
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Command/_cut	29 Oct 2007 13:31:32 -0000
@@ -0,0 +1,46 @@
+#compdef cut
+
+typeset -A _cut_args
+
+case $LANG in
+  (de_DE.UTF-8)
+     _cut_args=(
+           bytes           "nur diese Bytes ausgeben" 
+           characters      "nur diese Zeichen ausgeben" 
+           delimiter       "Delimiter anstelle von Tabulator als Trenner benutzen"
+           fields          "nur diese Felder und alle Zeilen OHNE Trennzeichen ausgeben"
+           n               "(ignoriert)"
+           complement      "das Komplement der Menge der gewählten Bytes, Zeichen oder Felder bilden"
+           only-delimited  "keine Zeilen ausgeben, die keinen Trenner enthalten"
+           output-delimiter "Zeichenkette als Ausgabetrennzeichen benutzen"
+           help            "diese Hilfe anzeigen und beenden"
+           version         "Versionsinformation anzeigen und beenden"
+     )
+  ;;
+  (*)
+     _cut_args=(
+           bytes           "select only these bytes"
+           characters      "select only these characters"
+           delimiter       "use DELIM instead of TAB for field delimiter"
+           fields          "select only these fields and lines whitout the delimiter character"
+           n               "(ignored)"
+           complement      "complement the set of selected bytes, characters or fields"
+           only-delimited  "do not print lines not containing delimiters"
+           output-delimiter "use STRING as the output delimiter"
+           help            "display this help and exit"
+           version         "output version information and exit"
+     )
+  ;;
+esac
+
+_arguments \
+        '(--bytes -b)'{--bytes=,-b}'['$_cut_args[bytes]']' \
+        '(--characters -c)'{--characters=,-c}'['$_cut_args[characters]']' \
+        '(--delimiter -d)'{--delimiter=,-d}'['$_cut_args[delimiter]']' \
+        '(--fields -f)'{--fields=,-f}'['$_cut_args[fields]']' \
+        '-n['$_cut_args[n]']' \
+        '--complement['$_cut_args[complement]']' \
+        '(--only-delimited -s)'{--only-delimited=,-s}'['$_cut_args[only-delimited]']' \
+        '--output-delimiter['$_cut_args[output-delimiter]']' \
+        '--help['$_cut_args[help]']' \
+        '--version['$_cut_args[version]']'


             reply	other threads:[~2007-10-29 13:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-29 13:56 Clint Adams [this message]
     [not found] ` <20071030060305.273140@gmx.net>
2007-10-30 17:15   ` Clint Adams
     [not found]     ` <20071030200829.208660@gmx.net>
2007-10-31  0:12       ` Clint Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071029135638.GA27117@scowler.net \
    --to=schizo@debian.org \
    --cc=448465@bugs.debian.org \
    --cc=waldeck@gmx.de \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).