From: Doug Kearns <dougkearns@gmail.com>
To: zsh-workers@sunsite.dk
Subject: PATCH: new shells completion type
Date: Wed, 22 Jun 2005 23:11:58 +1000 [thread overview]
Message-ID: <20050622131158.GB4591@localhost.localdomain> (raw)
Here is a new completion type for shells. It seems to me that if we're
going to complete shells from /etc/shells then it should be restricted
_only_ to shells listed there. This will change the behaviour of useradd
completion which always included /bin/false.
Any objections?
Regards,
Doug
Index: Completion/Unix/Command/_screen
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_screen,v
retrieving revision 1.10
diff -u -r1.10 _screen
--- Completion/Unix/Command/_screen 11 Jun 2005 12:28:17 -0000 1.10
+++ Completion/Unix/Command/_screen 22 Jun 2005 12:36:08 -0000
@@ -76,7 +76,7 @@
'-q[quiet startup, exit with non-zero return code if unsuccessful]' \
'-r[reattach to a detached screen process]: :->detached-sessions' \
'-R[reattach if possible, otherwise start a new session]: :->detached-sessions' \
- '-s[shell to execute rather than $SHELL]:shell name: _command_names -e' \
+ '-s[shell to execute rather than $SHELL]:shell:_shells' \
'-S[name this session <pid>.sockname instead of <pid>.<tty>.<host>]:session name' \
"-t[set title (window's name)]:title" \
'-T[use term as $TERM for windows, rather than "screen"]:terminal type:_terminals' \
Index: Completion/Unix/Command/_user_admin
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_user_admin,v
retrieving revision 1.6
diff -u -r1.6 _user_admin
--- Completion/Unix/Command/_user_admin 8 Jun 2005 12:45:35 -0000 1.6
+++ Completion/Unix/Command/_user_admin 22 Jun 2005 12:36:08 -0000
@@ -6,12 +6,6 @@
redhat=$?
if [[ $service = user* ]]; then
- if [[ -r /etc/shells ]]; then
- shells=( ${${(f)"$(</etc/shells)"}:#\#*} )
- else
- shells=( ${(M)commands:#*/(|[abckz]|tc|ba)sh} )
- fi
-
args=(
'(-D)-c+[comment]:comment'
"(-D)-${home}+[home directory]:home directory:_directories -W /"
@@ -19,7 +13,7 @@
'(-D)-f+[specify inactive days]:inactive days'
'(-D)-g+[initial group]:initial group:_groups'
'(-D)-G+[supplementary groups]:supplementary group:_groups -S,'
- "(-D)-s+[shell]:shell:( $shells /bin/false )"
+ "(-D)-s+[shell]:shell:_shells"
'(-D -M)-m[create home directory]'
'(-D)-u[uid]:uid'
'(-D)-o[allow non unique uid]'
Index: Completion/Unix/Type/_shells
===================================================================
RCS file: Completion/Unix/Type/_shells
diff -N Completion/Unix/Type/_shells
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Type/_shells 22 Jun 2005 12:36:08 -0000
@@ -0,0 +1,11 @@
+#compdef -value-,SHELL,-default-
+
+local expl shells
+
+if [[ -r /etc/shells ]]; then
+ shells=( ${${(f)"$(</etc/shells)"}:#\#*} )
+else
+ shells=( ${(M)commands:#*/((|[abckz]|tc|ba)sh|false)} )
+fi
+
+_wanted shells expl shell compadd -a "$@" - shells
next reply other threads:[~2005-06-22 13:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-22 13:11 Doug Kearns [this message]
2005-06-22 13:59 ` Oliver Kiddle
2005-06-22 15:04 ` Doug Kearns
2005-06-22 14:07 ` Stephane Chazelas
2005-06-22 14:18 ` Peter Stephenson
2005-06-22 14:42 ` Oliver Kiddle
2005-06-23 10:12 ` Doug Kearns
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=20050622131158.GB4591@localhost.localdomain \
--to=dougkearns@gmail.com \
--cc=zsh-workers@sunsite.dk \
/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).