Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: new shells completion type
- X-seq: zsh-workers 21371
- From: Doug Kearns <dougkearns@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: new shells completion type
- Date: Wed, 22 Jun 2005 23:11:58 +1000
- Mail-followup-to: zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author