From ce22a0686f1e8c08500109089c6c39334cb91531 Mon Sep 17 00:00:00 2001 From: Bapt Date: Mon, 8 Jun 2009 18:59:30 +0200 Subject: [PATCH] Initial creation of pw completion --- _pw | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 _pw diff --git a/_pw b/_pw new file mode 100644 index 0000000..cf12631 --- /dev/null +++ b/_pw @@ -0,0 +1,130 @@ +#compdef pw + +_pw() { + local tmp common_args user_cmn_args + common_args=( + "-V[Set the alternate location for /etc]:Alternate etc dir:_files -/" + '-C[Specify a different configuration file]:Configuration file:_files -g "*.conf"' + '-q[Suppress rrror messages]' + ) + user_cmn_args=( + '-n[Specify the name]:name:' + '-u[Specify the uid]:uid:' + ) + _arguments -s \ + '*::command:->commands' && ret=0 + while [[ -n "$state" ]]; do + tmp="$state" + state= + case "$tmp" in + commands) + if (( CURRENT == 1 )); then + state=subcommands + else + case "$words[1]" in + useradd) + ;; + userdel) + _arguments \ + $common_args \ + $user_cmn_args \ + "-r[Remove the user's home directory]" \ + "-Y[allow automatic updating of NIS database]" \ + ":Name or uid:_users" + ;; + usermod) + local shells + if [[ -r /etc/shells ]]; then + shells=( ${${(f)"$(