[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-49-gd803323

Ville Skyttä ville.skytta at iki.fi
Thu Oct 25 18:35:57 UTC 2012


The following commit has been merged in the master branch:
commit 8ec484692225f2f1565975a763df856dfbb7f27b
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Thu Oct 25 21:34:52 2012 +0300

    useradd, usermod: Support comma separated -G/--groups arg completion.

diff --git a/completions/useradd b/completions/useradd
index 33c41c6..4216e71 100644
--- a/completions/useradd
+++ b/completions/useradd
@@ -24,7 +24,8 @@ _useradd()
             return 0
             ;;
         -G|--groups)
-            COMPREPLY=( $( compgen -g -- "$cur" ) )
+            local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*},"
+            COMPREPLY=( $( compgen -P "$prefix" -g -- "${cur##*,}" ) )
             return 0
             ;;
         -s|--shell)
diff --git a/completions/usermod b/completions/usermod
index f8cd9e0..8999c6f 100644
--- a/completions/usermod
+++ b/completions/usermod
@@ -20,7 +20,8 @@ _usermod()
             return 0
             ;;
         -G|--groups)
-            COMPREPLY=( $( compgen -g -- "$cur" ) )
+            local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*},"
+            COMPREPLY=( $( compgen -P "$prefix" -g -- "${cur##*,}" ) )
             return 0
             ;;
         -s|--shell)

-- 
bash-completion



More information about the Bash-completion-commits mailing list