Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _chflags



At Thu, 02 Aug 2001 13:21:01 +0100,
Oliver Kiddle wrote:
> I'll add that (and the _sysctl change).
> 
> Is the nodump flag defintely turned off with nonodump then (as opposed
> to just dump)?
> 
> According to the man page you referenced, the flags are specified as a
> comma separated list so I would suggest you replace the flags= and
> compadd lines with something like:
> 
> _values -s , 'file flag'
> {no,}{arch,opaque,nodump,sappnd,schg,sunlnk,uappnd,uchg,uunlnk}
> 
> but if descriptions for the flags might be useful, you could use things
> like:
> '(noarch)arch[set archived]' to _values.
> It would be nice to use _arguments for the options. Are the options
> different on net/openbsd or different versions of FreeBSD? Do they all
> use the comma separated list of flags?

Ah, OK, I'm getting the hang of it.  Every point you addressed above
is correct.  Now what about the attached one? :)

And I have a couple of questions:

1. How can I prevent _values from sorting the values?
2. How can I let zsh automatically add `R' when one chooses -[LHP]?


Thanks,

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Freeze this moment a little bit longer, make each impression
  a little bit stronger..  Experience slips away -- Time stand still"

#compdef chflags

(( $+functions[__chflags] )) ||
__chflags() {
  if [[ CURRENT -eq 2 || $words[CURRENT-1] = -* ]]; then
    case $OSTYPE in
     freebsd*)
      _values -s , 'file flags' \
       '(noarch)arch[set the archived flag (super-user only)]' \
       '(arch)noarch[unset the archived flag (super-user only)]' \
       '(noopaque)opaque[set the opaque flag (owner or super-user only)]' \
       '(opaque)noopaque[unset the opaque flag (owner or super-user only)]' \
       '(dump)nodump[set the nodump flag (owner or super-user only)]' \
       '(nodump)dump[unset the nodump flag (owner or super-user only)]' \
       '(nosappnd)sappnd[set the system append-only flag (super-user only)]' \
       '(sappnd)nosappnd[unset the system append-only flag (super-user only)]' \
       '(noschg)schg[set the system immutable flag (super-user only)]' \
       '(schg)noschg[unset the system immutable flag (super-user only)]' \
       '(nosunlnk)sunlnk[set the system undeletable flag (super-user only)]' \
       '(sunlnk)nosunlnk[unset the system undeletable flag (super-user only)]' \
       '(nouappnd)uappnd[set the user append-only flag (owner or super-user only)]' \
       '(uappnd)nouappnd[unset the user append-only flag (owner or super-user only)]' \
       '(nouchg)uchg[set the user immutable flag (owner or super-user only)]' \
       '(uchg)nouchg[unset the user immutable flag (owner or super-user only)]' \
       '(nouunlnk)uunlnk[set the user undeletable flag (owner or super-user only)]' \
       '(uunlnk)nouunlnk[unset the user undeletable flag (owner or super-user only)]'
     ;;
     netbsd*|openbsd*)	  
      _values -s , 'file flags' \
       '(noarch)arch[set the archived flag (super-user only)]' \
       '(arch)noarch[unset the archived flag (super-user only)]' \
       '(noopaque)opaque[set the opaque flag (owner or super-user only)]' \
       '(opaque)noopaque[unset the opaque flag (owner or super-user only)]' \
       '(dump)nodump[set the nodump flag (owner or super-user only)]' \
       '(nodump)dump[unset the nodump flag (owner or super-user only)]' \
       '(nosappnd)sappnd[set the system append-only flag (super-user only)]' \
       '(sappnd)nosappnd[unset the system append-only flag (super-user only)]' \
       '(noschg)schg[set the system immutable flag (super-user only)]' \
       '(schg)noschg[unset the system immutable flag (super-user only)]' \
       '(nouappnd)uappnd[set the user append-only flag (owner or super-user only)]' \
       '(uappnd)nouappnd[unset the user append-only flag (owner or super-user only)]' \
       '(nouchg)uchg[set the user immutable flag (owner or super-user only)]' \
       '(uchg)nouchg[unset the user immutable flag (owner or super-user only)]'
      ;;
    esac
  else
    _files
  fi
}

_arguments -s -A "-*" \
      '(-L -P)-H[follow symlinks on the command line (specify with -R)]' \
      '(-H -P)-L[follow all symlinks (specify with -R)]' \
      '(-L -H)-P[do not follow symlinks (specify with -R)]' \
      '-R[recurse direcotries]' \
      '*:flags and files:__chflags'



Messages sorted by: Reverse Date, Date, Thread, Author