zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: qcd@gmx.net, zsh-workers@zsh.org
Subject: Re: Bug path completion chsh -s
Date: Fri, 22 Aug 2014 21:08:46 -0700	[thread overview]
Message-ID: <140822210846.ZM22535@torch.brasslantern.com> (raw)
In-Reply-To: <53F67562.2030102@gmx.net>

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


  reply	other threads:[~2014-08-23  4:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-21 22:40 qcd
2014-08-23  4:08 ` Bart Schaefer [this message]
2014-08-23 19:31   ` Bart Schaefer
2014-08-25 15:37     ` Jun T.
2014-08-24  4:38   ` Mikael Magnusson

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=140822210846.ZM22535@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=qcd@gmx.net \
    --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).