From 08203f7743ea41e7f10a891c130a18be713bd494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 28 Dec 2012 14:07:34 +0200 Subject: [PATCH] luseradd,lusermod,luserdel: New completions. --- completions/.gitignore | 1 + completions/Makefile.am | 7 ++++++ completions/luseradd | 40 +++++++++++++++++++++++++++++++ completions/luserdel | 23 ++++++++++++++++++ test/completion/luseradd.exp | 1 + test/completion/luserdel.exp | 1 + test/completion/lusermod.exp | 1 + test/lib/completions/luseradd.exp | 18 ++++++++++++++ test/lib/completions/luserdel.exp | 18 ++++++++++++++ test/lib/completions/lusermod.exp | 18 ++++++++++++++ 10 files changed, 128 insertions(+) create mode 100644 completions/luseradd create mode 100644 completions/luserdel create mode 100644 test/completion/luseradd.exp create mode 100644 test/completion/luserdel.exp create mode 100644 test/completion/lusermod.exp create mode 100644 test/lib/completions/luseradd.exp create mode 100644 test/lib/completions/luserdel.exp create mode 100644 test/lib/completions/lusermod.exp diff --git a/completions/.gitignore b/completions/.gitignore index 9009b68c..7d80a206 100644 --- a/completions/.gitignore +++ b/completions/.gitignore @@ -71,6 +71,7 @@ ldapmodrdn ldappasswd ldapwhoami lintian-info +lusermod lvchange lvcreate lvdisplay diff --git a/completions/Makefile.am b/completions/Makefile.am index 2efe3228..20aaa328 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -179,6 +179,8 @@ bashcomp_DATA = a2x \ lpr \ lrzip \ lsof \ + luseradd \ + luserdel \ lvm \ lzip \ lzma \ @@ -441,6 +443,7 @@ CLEANFILES = \ ldappasswd \ ldapwhoami \ lintian-info \ + lusermod \ lvchange \ lvcreate \ lvdisplay \ @@ -684,6 +687,10 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) lintian $(targetdir)/$$file ; \ done + for file in lusermod ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) luseradd $(targetdir)/$$file ; \ + done for file in lvmdiskscan pvscan pvs pvdisplay pvchange pvcreate pvmove \ pvremove vgscan vgs vgdisplay vgchange vgremove vgrename \ vgreduce vgextend vgimport vgexport vgck vgconvert vgcreate \ diff --git a/completions/luseradd b/completions/luseradd new file mode 100644 index 00000000..e5b00c3c --- /dev/null +++ b/completions/luseradd @@ -0,0 +1,40 @@ +# luseradd(1) and lusermod(1) completion -*- shell-script -*- + +_luseradd() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -\?|--help|--usage|-c|--gecos|-u|--uid|-l|--login|-P|--plainpassword|\ + -p|--password|--commonname|--givenname|--surname|--roomnumber|\ + --telephonenumber|--homephone) + return + ;; + -d|--directory|-k|--skeleton) + _filedir -d + return + ;; + -s|--shell) + _shells + return + ;; + -g|--gid) + _gids + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + [[ ${1##*/} == luseradd ]] || COMPREPLY=( $( compgen -u -- "$cur" ) ) +} && +complete -F _luseradd luseradd lusermod + +# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/luserdel b/completions/luserdel new file mode 100644 index 00000000..05faaac2 --- /dev/null +++ b/completions/luserdel @@ -0,0 +1,23 @@ +# luserdel(1) completion -*- shell-script -*- + +_luserdel() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -\?|--help|--usage) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + COMPREPLY=( $( compgen -u -- "$cur" ) ) +} && +complete -F _luserdel luserdel + +# ex: ts=4 sw=4 et filetype=sh diff --git a/test/completion/luseradd.exp b/test/completion/luseradd.exp new file mode 100644 index 00000000..69b10cfe --- /dev/null +++ b/test/completion/luseradd.exp @@ -0,0 +1 @@ +assert_source_completions luseradd diff --git a/test/completion/luserdel.exp b/test/completion/luserdel.exp new file mode 100644 index 00000000..289a4c32 --- /dev/null +++ b/test/completion/luserdel.exp @@ -0,0 +1 @@ +assert_source_completions luserdel diff --git a/test/completion/lusermod.exp b/test/completion/lusermod.exp new file mode 100644 index 00000000..9ca4cecc --- /dev/null +++ b/test/completion/lusermod.exp @@ -0,0 +1 @@ +assert_source_completions lusermod diff --git a/test/lib/completions/luseradd.exp b/test/lib/completions/luseradd.exp new file mode 100644 index 00000000..744314a7 --- /dev/null +++ b/test/lib/completions/luseradd.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "luseradd -" +sync_after_int + + +teardown diff --git a/test/lib/completions/luserdel.exp b/test/lib/completions/luserdel.exp new file mode 100644 index 00000000..70d11661 --- /dev/null +++ b/test/lib/completions/luserdel.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "luserdel " +sync_after_int + + +teardown diff --git a/test/lib/completions/lusermod.exp b/test/lib/completions/lusermod.exp new file mode 100644 index 00000000..f96293e6 --- /dev/null +++ b/test/lib/completions/lusermod.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "lusermod " +sync_after_int + + +teardown