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

Re: Bug path completion chsh -s



On 23 August 2014 06:08, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Aug 22, 12:40am, qcd wrote:
> }
> } > chsh -s <tab>
> }
> } in  normal shellproposes  a path list but in zsh that does not work.
>
> What is "normal shell"?  Bash?  What version?  Are you on a single-user
> system you set up yourself, or are you at a school or business where an
> administrator has pre-configured the "normal shell"?
>
> Also, chsh has different syntax on different OS's:  On MacOS it's an
> alias for chpass; on Ubuntu it only has --help and --shell options
> (and their -h -s counterparts); on RHEL it has several options and
> uses -u instead of -h for --help, and adds -l for --list, both of
> which conflict with chpass on MacOs; and so on.  So "please fix" is
> a rather open-ended request.
>
> Oh well, never mind.  Here's something for RHEL; perhaps you can figure
> out how to fix it for your local environment, or just remove everything
> except -s, given that's the one thing they all seem to have in common.
>
> ---- 8< ---- name this _chsh and put in an fpath directory ---- 8< ----
> #compdef chsh
> local -a opts
> opts=(-s -l -u -v --shell --list-shells --help --version)
> _arguments : \
>    "($opts)-s[Specify your login shell]:shell:($(</etc/shells))" \
>    "($opts)--shell[Specify your login shell]:shell:($(</etc/shells))" \
>    "($opts)-l[Print shells in /etc/shells]" \
>    "($opts)--list-shells[Print shells in /etc/shells]" \
>    "($opts)-u[Print a usage message and exit]" \
>    "($opts)--help[Print a usage message and exit]" \
>    "($opts)-v[Print version information and exit]" \
>    "($opts)--version[Print version information and exit]"
> ---- 8< ---- snip ---- 8< ---- -------- ---- 8< ---- snip ---- 8< ----
>
> Maybe somebody else can remind me if there's an easier way to indicate
> to _arguments that all the arguments are mutually exclusive.  (RedHat
> chsh accepts more than one but only uses the first one it encounters.)

chsh is listed on the compdef line of _users, so you need to remove
that as well. (maybe not since c comes before u, but we still should
remove it if this is committed).

-- 
Mikael Magnusson



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