zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: completion file for the command 'cat'
Date: Mon, 28 Oct 2013 01:06:55 +0900	[thread overview]
Message-ID: <6282BB94-2FB5-42AD-BD99-0A508966992E@kba.biglobe.ne.jp> (raw)

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

Attached is a completion function for the command 'cat'.

Only Linux and Mac OS X (and relatives) are supported seriously.


[-- Attachment #2: _cat --]
[-- Type: application/octet-stream, Size: 1444 bytes --]

#compdef cat

local -a args

if _pick_variant gnu=GNU unix --version; then
  args=(
    '(-A --show-all)'{-A,--show-all}'[equivalent to -vET]'
    '(-b --number-nonblank -n --number)'{-b,--number-nonblank}'[number nonempty output lines, overrides -n]'
    '-e[equivalent to -vE]'
    '(-E --show-ends)'{-E,--show-ends}'[display $ at end of each line]'
    '(-n --number)'{-n,--number}'[number all output lines]'
    '(-s --squeeze-blank)'{-s,--squeeze-blank}'[suppress repeated empty output lines]'
    '-t[equivalent to -vT]'
    '(-T --show-tabs)'{-T,--show-tabs}'[display TAB characters as ^I]'
    '-u[ignored]'
    '(-v --show-nonprinting)'{-v,--show-nonprinting}'[use ^ and M- notation, except for LFD and TAB]'
    '(- : *)--help[display help and exit]'
    '(- : *)--version[output version information and exit]'
    '*:files:_files'
  )

elif [[ "$OSTYPE" == (freebsd|dragonfly|darwin)* ]]; then
  args=(
    '(-n)-b[number non-blank output lines]'
    '(-v)-e[display $ at the end of each line (implies -v)]'
    '-n[number all output lines]'
    '-s[squeeze multiple blank lines into one]'
    '(-v)-t[display tab as ^I (implies -v)]'
    '-u[do not buffer output]'
    '-v[display non-printing chars as ^X or M-a]'
    '(-)*:files:_files'
  )

else
  # POSIX reqires '-u', and most OSes may support '-n'
  args=(
    '-n[number all output lines]'
    '-u[do not buffer output]'
    '*:files:_files'
  )
fi

_arguments -s -S : $args

                 reply	other threads:[~2013-10-27 16:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=6282BB94-2FB5-42AD-BD99-0A508966992E@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \
    /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).