zsh-workers
 help / color / mirror / code / Atom feed
* Re: new-style completition for gnu grep and ls
@ 2001-01-09  8:51 Sven Wischnowsky
  2001-01-10 17:53 ` Completion services patch (Re: new-style completition for gnu grep and ls) Bart Schaefer
  2001-01-13 23:09 ` new-style completition for gnu grep and ls Ulrik Haugen
  0 siblings, 2 replies; 3+ messages in thread
From: Sven Wischnowsky @ 2001-01-09  8:51 UTC (permalink / raw)
  To: zsh-workers


Ulrik Haugen wrote:

> I've written completition functions for the gnu versions of grep and ls. (I
> use zsh 3.1.9-dev-6 and I couldn't find completition for them.)

Thanks for your help. Very much appreciated.

> I'd be happy if you include them in future releases.

I can foresee some more discussion with people who don't have
GNU-systems and who don't like GNU-specific completion functions for
commands. So either we find a way to check for GNU/non-GNU completion
in your functions or we'll wait until we have a sub-directory for
GNU-specific completion functions.

> local efgrep="" E extended_regexp F fixed_strings
> 
> case "${words[1]:t}" in
> (egrep|fgrep) efgrep=t;
>     ;;
> esac

That could be done with `[[ "${words[1]:t}" = [ef]grep ]] && efgrep=t'.


That also reminds me that my services-patch (`compdef krsh=rsh', see
12977) is still not committed, mostly because I got no reply...


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Completion services patch (Re: new-style completition for gnu grep and ls)
  2001-01-09  8:51 new-style completition for gnu grep and ls Sven Wischnowsky
@ 2001-01-10 17:53 ` Bart Schaefer
  2001-01-13 23:09 ` new-style completition for gnu grep and ls Ulrik Haugen
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2001-01-10 17:53 UTC (permalink / raw)
  To: zsh-workers

On Jan 9,  9:51am, Sven Wischnowsky wrote:
} Subject: Re: new-style completition for gnu grep and ls
}
} That also reminds me that my services-patch (`compdef krsh=rsh', see
} 12977) is still not committed, mostly because I got no reply...

Sorry, I have some three-month-or-more-old items sitting around waiting to
be responded to.

I think 12977 is fine.  It's possible that part of the reason I didn't
reply right away was that I was still trying to reconcile this with the
more generalized aliasing scheme I mentioned in 12964, but I still don't
have a clear idea whether/how such aliasing would be useful, so there's
no point in holding this up.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: new-style completition for gnu grep and ls
  2001-01-09  8:51 new-style completition for gnu grep and ls Sven Wischnowsky
  2001-01-10 17:53 ` Completion services patch (Re: new-style completition for gnu grep and ls) Bart Schaefer
@ 2001-01-13 23:09 ` Ulrik Haugen
  1 sibling, 0 replies; 3+ messages in thread
From: Ulrik Haugen @ 2001-01-13 23:09 UTC (permalink / raw)
  To: zsh-workers

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

* Sven Wischnowsky <wischnow@informatik.hu-berlin.de>:
> Ulrik Haugen wrote:
> > I'd be happy if you include them in future releases.
> 
> I can foresee some more discussion with people who don't have
> GNU-systems and who don't like GNU-specific completion functions for
> commands. So either we find a way to check for GNU/non-GNU completion
> in your functions or we'll wait until we have a sub-directory for
> GNU-specific completion functions.

Ok, I gave the manpages on solaris a bit more than a glance and all short
options seem to be the same. Now they check what version is available and
completes accordingly. (Hmm, maybe the check should depend on what command is
being completed in words[1]...)
Also I've cleaned them up a little. I hope these can make it into the
distribution.

-- 
Ulrik Haugen <qha@lysator.liu.se>
"It's a poor laser blaster that doesn't work both ways"
        -- Salvor Hardin through Isaac Asimov

[-- Attachment #2: _ls --]
[-- Type: text/plain, Size: 3364 bytes --]

#compdef ls
# Ulrik Haugen 2001

local arguments

arguments=( \
  '*:files:_files' \
  \
  '(--all -A --almost-all)-a[all]' '(-a -A --almost-all)--all' \
  '(--almost-all -a --all)-A[almost all]' '(-A -a --all)--almost-all' \
  '(--ignore-backups)-B[ignore backups]' '(-B)--ignore-backups' \
  '(--directory)-d[directory]' '(-d)--directory' \
  {'(--ignore)-I+[ignore]','(-I)--ignore='}':ignore:' \
  '(--dereference)-L[dereference]' '(-L)--dereference' \
  '(--recursive)-R[recursive]' '(-R)--recursive' \
  \
  '(--no-group)-G[no group]' '(-G)--no-group' \
  '(--human-readable -H --si)-h[human readable]' '(-h -H --si)--human-readable' \
  '(--si -h --human-readable)-H[si]' '(-H -h --human-readable)--si' \
  '(--inode)-i[inode]' '(-i)--inode' \
  \
  '(--format -o -1 -C -m -x)-l[long]' \
  '(--format -l --no-group -1 -C -m -x)-o[no group, long]' \
  '(--format -l -o -C -m -x)-1[single column]' \
  '(--format -l -o -1 -m -x)-C[sort vertically]' \
  '(--format -l -o -1 -C -x)-m[comma separated]' \
  '(--format -l -o -1 -C -m)-x[sort horizontally]' \
  '(-l -o -1 -C -m -x)--format=:format:(verbose long commas horizontal across vertical single-column)' \
  \
  '(--size -f)-s[size]' '(-s -f)--size' \
  \
  '(--time -u)-c[status change time]' \
  '(--time -c)-u[access time]' \
  '(-c -u)--time=:time:(ctime status use atime access)' \
  \
  '(-a --all -U -l --format -s --size -t --sort)-f[no sort, all]' \
  '(--reverse)-r[reverse]' '(-r)--reverse' \
  \
  '(--sort -t -U -v -X)-S[sort by size]' \
  '(--sort -S -U -v -X)-t[sort by time]' \
  '(--sort -S -t -v -X)-U[no sort]' \
  '(--sort -S -t -U -X)-v[sort by version]' \
  '(--sort -S -t -U -v)-X[sort by extention]' \
  '(-S -t -U -v -X)--sort=:sort:(size time none version extention)' \
  \
  '--color=::color:(never always auto)' \
  \
  '(--classify --indicator-style -p --file-type)-F[classify]'  \
  '(-F --indicator-style -p --file-type)--classify' \
  '(--file-type --indicator-style -F --classify)-p[file type]' \
  '(-p --indicator-style -F --classify)--file-type' \
  '(-F --classify -p --file-type)--indicator-style=:indicator style:(none file-type classify)' \
  \
  '--full-time' \
  \
  '(--kilobytes --block-size)-k[kilobytes]' '(-k --blocksize)--kilobytes' \
  '(-k --kilobytes)--block-size:blocksize:(1024)' \
  \
  '(--numeric-uid-gid)-n[numeric uid, gid]' \
  {'(--tabsize)-T+[tabsize]','(-T)--tabsize='}':tabsize:(8)' \
  {'(--width)-w+[width]','(-w)--width='}':width:(80)' \
  \
  '(--quoting-style --escape -N --literal -Q --quote-name)-b[escape]' \
  '(--quoting-style -b -N --literal -Q --quote-name)--escape' \
  '(--quoting-style -b --escape --literal -Q --quote-name)-N[literal]' \
  '(--quoting-style -b --escape -N -Q --quote-name)--literal' \
  '(--quoting-style -b --escape -N --literal --quote-name)-Q[quote name]' \
  '(--quoting-style -b --escape -N --literal -Q)--quote-name' \
  '(-b --escape -N --literal -Q --quote-name)--quoting-style=:quoting style:(literal shell shell-always c escape clocale locale)' \
  \
  '(--hide-control-chars --show-control-chars)-q[hide control chars]' \
  '(-q --show-control-chars)--hide-control-chars' \
  '(-q --hide-control-chars)--show-control-chars' \
  '--version' \
  )

# remove long options?
ls --version >/dev/null 2>&1 || arguments=( ${${${${arguments:#*\)--*}:#--*}//--[^ )]#/}/\( #\)/} )

_arguments -C -s $arguments

[-- Attachment #3: _grep --]
[-- Type: text/plain, Size: 2466 bytes --]

#compdef grep egrep fgrep
# Ulrik Haugen 2001

local efgrep="" efarguments arguments

[[ "${words[1]:t}" = [ef]grep ]] && efgrep=t

if [[ -z $efgrep ]]; then
    efarguments=( \
      '(--extended-regexp -F --fixed-strings)-E[extended regexp]' \
      '(-E -F --fixed-strings)--extended-regexp' \
      '(--fixed-strings -E --extended-regexp)-F[fixed strings]' \
      '(-F -E --extended-regexp)--fixed-strings' \
      )
fi

arguments=( \
  '(-e --regexp -f --file)1:pattern:' \
  {'(--regexp -f --file 1)-e+[regexp]','(-e -f --file 1)--regexp='}':regexp:' \
  {'(--file -e --regexp 1)-f+[file]','(-f -e --regexp 1)--file='}':pattern file:_files' \
  \
  '*:files:_files' \
  \
  {'(--after-context)-A+[after context]','(-A)--after-context='}':after context:(1)' \
  '(--text --binary-files)-a[text]' '(-a --binary-files)--text' \
  {'(--before-context)-B+[before context]','(-B)--before-context='}':before context:(1)' \
  {'(--context)-C+[context]','(-C)--context='}':context:(1)' \
  '(--byte-offset)-b[byte offset]' '(-b)--byte-offset' \
  '(-a --text -I)--binary-files:binary files:(binary without-match text)' \
  '(--count)-c[count]' '(-c)--count' \
  {'(--directories -r --recursive)-d+[directories]','(-d -r --recursive)--directories='}':directories:(read skip recurse grep)' \
  \
  $efarguments \
  \
  '(--basic-regexp)-G[basic regexp]' '(-G)--basic-regexp' \
  '(--with-filename)-H[with filename]' '(-H)--with-filename' \
  '(--no-filename)-h[no filename]' '(-h)--no-filename' \
  '--help' \
  '(--binary-files)-I[ignore binary]' \
  '(--ignore-case)-i[ignore case]' '(-i)--ignore-case' \
  '(--files-without-match)-L[files without match]' '(-L)--files-without-match' \
  '(--file-with-matches)-l[files with matches]' '(-l)--files-with-matches' \
  '--mmap' \
  '(--line-number)-n[line number]' '(-n)--line-number' \
  '(--quiet --silent)-q[quiet]' '(-q --quiet)--silent' '(-q --silent)--quiet' \
  '(--recursive -d --directories)-r[recursive]' '(-r -d --directories)--recursive' \
  '(--no-mesages)-s[no messages]' '(-s)--no-messages' \
  '(--version)-V[version]' '(-V)--version' \
  '(--invert-match)-v[invert match]' '(-v)--invert-match' \
  '(--word-regexp)-w[word regexp]' '(-w)--word-regexp' \
  '(--line-regexp)-x[line regexp]' '(-x)--line-regexp' \
  '(--null)-Z[null]' '(-Z)--null' \
  )

# remove long options?
grep --version >/dev/null 2>&1 || arguments=( ${${${${arguments:#*\)--*}:#--*}//--[^ )]#/}/\( #\)/} )

_arguments -C -s $arguments

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-01-13 23:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-09  8:51 new-style completition for gnu grep and ls Sven Wischnowsky
2001-01-10 17:53 ` Completion services patch (Re: new-style completition for gnu grep and ls) Bart Schaefer
2001-01-13 23:09 ` new-style completition for gnu grep and ls Ulrik Haugen

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).