[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-265-g08a4c0e

Ville Skyttä ville.skytta at iki.fi
Wed May 4 19:54:15 UTC 2011


The following commit has been merged in the master branch:
commit 997ecac0f02009133aa4fc9da87d00ff3cb5680b
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Wed May 4 22:47:05 2011 +0300

    samba: Use _parse_help, add bunch of option completions and basic test cases.

diff --git a/completions/samba b/completions/samba
index 5a6261f..f916bce 100644
--- a/completions/samba
+++ b/completions/samba
@@ -28,13 +28,25 @@ _samba_debuglevel()
     COMPREPLY=( $( compgen -W '{0..10}' -- "$cur" ) )
 }
 
+_samba_sockopts()
+{
+    COMPREPLY=( $( compgen -W 'SO_KEEPALIVE SO_REUSEADDR SO_BROADCAST
+        TCP_NODELAY IPTOS_LOWDELAY IPTOS_THROUGHPUT SO_SNDBUF SO_RCVBUF
+        SO_SNDLOWAT SO_RCVLOWAT' -- "$cur" ) )
+}
+
+_samba_signing()
+{
+    COMPREPLY=( $( compgen -W 'on off required' -- "$cur" ) )
+}
+
 _smbclient()
 {
     local cur prev words cword split
     _init_completion -s || return
 
     case $prev in
-        -R)
+        -R|--name-resolve)
             _samba_resolve_order
             return 0;
             ;;
@@ -43,19 +55,16 @@ _smbclient()
                 -- "$cur" ) )
             return 0;
             ;;
-        -s|-A|--authentication-file)
+        -s|--configfile|-A|--authentication-file)
             _filedir
             return 0;
             ;;
-        -l|--log-basename|-D)
+        -l|--log-basename|-D|--directory)
             _filedir -d
             return 0;
             ;;
-        -O)
-            COMPREPLY=( $( compgen -W 'SO_KEEPALIVE SO_REUSEADDR \
-                SO_BROADCAST TCP_NODELAY IPTOS_LOWDELAY \
-                IPTOS_THROUGHPUT SO_SNDBUF SO_RCVBUF \
-                SO_SNDLOWAT SO_RCVLOWAT' -- "$cur" ) )
+        -O|--socket-options)
+            _samba_sockopts
             return 0;
             ;;
         -T)
@@ -70,7 +79,16 @@ _smbclient()
             _samba_debuglevel
             return 0
             ;;
-        -p|--port|-M|-I|-b|-U|--user|-n|-i|-T|-c)
+        -L|--list)
+            _samba_hosts
+            return 0
+            ;;
+        -S|--signing)
+            _samba_signing
+            return 0
+            ;;
+        -p|--port|-M|--message|-I|--ip-address|-b|--send-buffer|-U|--user|-n|\
+        --netbiosname|-i|--scope|-T|--tar|-c|--command|-m|--max-protocol)
             # argument required but no completions available
             return 0
             ;;
@@ -83,9 +101,8 @@ _smbclient()
     $split && return 0
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '-b -d -L -U -I -M -m -A -N -i -O \
-            -p -R -s -k -P -c -D -W -l -E --debuglevel \
-            --log-basename --workgroup' -- "$cur" ) )
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+        [[ $COMPREPLY == *= ]] && compopt -o nospace
     fi
 } &&
 complete -F _smbclient smbclient
@@ -96,7 +113,7 @@ _smbget()
     _init_completion -s || return
 
     case $prev in
-        -o|-f|--outputfile|--rcfile)
+        -o|--outputfile|-f|--rcfile)
             _filedir
             return 0;
             ;;
@@ -104,16 +121,20 @@ _smbget()
             _samba_debuglevel
             return 0
             ;;
+        -w|--workgroup)
+            _samba_domains
+            return 0
+            ;;
+        -u|--username|-p|--password|-b|--blocksize)
+            return 0
+            ;;
     esac
 
     $split && return 0
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '-a --guest -r --resume -R --recursive -u \
-            --username -p --password -w --workgroup -n --nonprompt -d \
-            --debuglevel -D --dots -P --keep-permissions -o --outputfile -f \
-            --rcfile -q --quiet -v --verbose -b --blocksize -? --help --usage' \
-            -- "$cur" ) )
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+        [[ $COMPREPLY == *= ]] && compopt -o nospace
     fi
 } &&
 complete -F _smbget smbget
@@ -124,7 +145,7 @@ _smbcacls()
     _init_completion -s || return
 
     case $prev in
-        -s)
+        -s|--configfile|-A|--authentication-file)
             _filedir
             return 0;
             ;;
@@ -136,13 +157,29 @@ _smbcacls()
             _samba_debuglevel
             return 0
             ;;
+        --signing)
+            _samba_signing
+            return 0
+            ;;
+        -O|--socket-options)
+            _samba_sockopts
+            return 0
+            ;;
+        -W|--workgroup)
+            _samba_domains
+            return 0
+            ;;
+        -\?|--help|--usage|-D|--delete|-M|--modify|-a|--add|-S|--set|-C|\
+        --chown|-G|--chgrp|-n|--netbiosname|-i|--scope|-U|--user)
+            return 0
+            ;;
     esac
 
     $split && return 0
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '-a -M -D -S -U -C -G --numeric -t \
-            -h --help -V -s -d --debuglevel -l --log-basename' -- "$cur" ) )
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+        [[ $COMPREPLY == *= ]] && compopt -o nospace
     fi
 } &&
 complete -F _smbcacls smbcacls
@@ -153,7 +190,7 @@ _smbcquotas()
     _init_completion -s || return
 
     case $prev in
-        -s|-A|--authentication-file)
+        -s|--configfile|-A|--authentication-file)
             _filedir
             return 0;
             ;;
@@ -165,14 +202,20 @@ _smbcquotas()
             _samba_debuglevel
             return 0
             ;;
+        --signing)
+            _samba_signing
+            return 0
+            ;;
+        -\?|--help|--usage|-U|-u|--user|-S|--set)
+            return 0
+            ;;
     esac
 
     $split && return 0
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '-u -L -F -S -n -t -v -h --help -V \
-            -s --debuglevel --log-basename -N -k \
-            --authentication-file --user' -- "$cur" ) )
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+        [[ $COMPREPLY == *= ]] && compopt -o nospace
     fi
 } &&
 complete -F _smbcquotas smbcquotas
@@ -199,11 +242,13 @@ _smbpasswd()
             _samba_debuglevel
             return 0
             ;;
+        -U|-h|-w)
+            return 0
+            ;;
     esac
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '-a -c -x -d -e -D -n -r -R -m -U -h \
-            -s -w -W -i -L' -- "$cur" ) )
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
     fi
 } &&
 complete -F _smbpasswd smbpasswd
@@ -226,11 +271,17 @@ _smbtar()
             _samba_debuglevel
             return 0
             ;;
+        -N)
+            _filedir
+            return 0
+            ;;
+        -p|-x|-b|-d|-u)
+            return 0
+            ;;
     esac
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '-r -i -a -v -s -p -x -X -N -b -d -l -u -t' \
-            -- "$cur" ) )
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
     fi
 } &&
 complete -F _smbtar smbtar
@@ -241,7 +292,7 @@ _smbtree()
     _init_completion -s || return
 
     case $prev in
-        -s|-A|--authentication-file)
+        -s|--configfile|-A|--authentication-file)
             _filedir
             return 0;
             ;;
@@ -253,14 +304,20 @@ _smbtree()
             _samba_debuglevel
             return 0
             ;;
+        -S|--signing)
+            _samba_signing
+            return 0
+            ;;
+        -\?|--help|--usage|-U|--user)
+            return 0
+            ;;
     esac
 
     $split && return 0
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '-b -D -S -V -s -d --debuglevel -l \
-            --log-basename -N -k -A --authentication-file -U --user\
-            -h --help' -- "$cur" ) )
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+        [[ $COMPREPLY == *= ]] && compopt -o nospace
     fi
 } &&
 complete -F _smbtree smbtree
diff --git a/test/completion/smbcacls.exp b/test/completion/smbcacls.exp
new file mode 100644
index 0000000..333a14e
--- /dev/null
+++ b/test/completion/smbcacls.exp
@@ -0,0 +1 @@
+assert_source_completions smbcacls
diff --git a/test/completion/smbclient.exp b/test/completion/smbclient.exp
new file mode 100644
index 0000000..09b9ad3
--- /dev/null
+++ b/test/completion/smbclient.exp
@@ -0,0 +1 @@
+assert_source_completions smbclient
diff --git a/test/completion/smbcquotas.exp b/test/completion/smbcquotas.exp
new file mode 100644
index 0000000..f7c4e94
--- /dev/null
+++ b/test/completion/smbcquotas.exp
@@ -0,0 +1 @@
+assert_source_completions smbcquotas
diff --git a/test/completion/smbget.exp b/test/completion/smbget.exp
new file mode 100644
index 0000000..8f6c849
--- /dev/null
+++ b/test/completion/smbget.exp
@@ -0,0 +1 @@
+assert_source_completions smbget
diff --git a/test/completion/smbpasswd.exp b/test/completion/smbpasswd.exp
new file mode 100644
index 0000000..de2297a
--- /dev/null
+++ b/test/completion/smbpasswd.exp
@@ -0,0 +1 @@
+assert_source_completions smbpasswd
diff --git a/test/completion/smbtar.exp b/test/completion/smbtar.exp
new file mode 100644
index 0000000..72dd9f1
--- /dev/null
+++ b/test/completion/smbtar.exp
@@ -0,0 +1 @@
+assert_source_completions smbtar
diff --git a/test/completion/smbtree.exp b/test/completion/smbtree.exp
new file mode 100644
index 0000000..713c5ba
--- /dev/null
+++ b/test/completion/smbtree.exp
@@ -0,0 +1 @@
+assert_source_completions smbtree
diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/smbcacls.exp
similarity index 78%
copy from test/lib/completions/a2ps.exp
copy to test/lib/completions/smbcacls.exp
index 77cd07f..d501f82 100644
--- a/test/lib/completions/a2ps.exp
+++ b/test/lib/completions/smbcacls.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "a2ps "
+assert_complete_any "smbcacls -"
 
 
 sync_after_int
diff --git a/test/lib/completions/aclocal.exp b/test/lib/completions/smbclient.exp
similarity index 77%
copy from test/lib/completions/aclocal.exp
copy to test/lib/completions/smbclient.exp
index da133aa..0fb8e2d 100644
--- a/test/lib/completions/aclocal.exp
+++ b/test/lib/completions/smbclient.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "aclocal "
+assert_complete_any "smbclient -"
 
 
 sync_after_int
diff --git a/test/lib/completions/aclocal.exp b/test/lib/completions/smbcquotas.exp
similarity index 77%
copy from test/lib/completions/aclocal.exp
copy to test/lib/completions/smbcquotas.exp
index da133aa..24be2f6 100644
--- a/test/lib/completions/aclocal.exp
+++ b/test/lib/completions/smbcquotas.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "aclocal "
+assert_complete_any "smbcquotas -"
 
 
 sync_after_int
diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/smbget.exp
similarity index 79%
copy from test/lib/completions/a2ps.exp
copy to test/lib/completions/smbget.exp
index 77cd07f..938cd0e 100644
--- a/test/lib/completions/a2ps.exp
+++ b/test/lib/completions/smbget.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "a2ps "
+assert_complete_any "smbget -"
 
 
 sync_after_int
diff --git a/test/lib/completions/aclocal.exp b/test/lib/completions/smbpasswd.exp
similarity index 77%
copy from test/lib/completions/aclocal.exp
copy to test/lib/completions/smbpasswd.exp
index da133aa..b6e86bb 100644
--- a/test/lib/completions/aclocal.exp
+++ b/test/lib/completions/smbpasswd.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "aclocal "
+assert_complete_any "smbpasswd -"
 
 
 sync_after_int
diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/smbtar.exp
similarity index 79%
copy from test/lib/completions/a2ps.exp
copy to test/lib/completions/smbtar.exp
index 77cd07f..e0d58f5 100644
--- a/test/lib/completions/a2ps.exp
+++ b/test/lib/completions/smbtar.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "a2ps "
+assert_complete_any "smbtar -"
 
 
 sync_after_int
diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/smbtree.exp
similarity index 78%
copy from test/lib/completions/a2ps.exp
copy to test/lib/completions/smbtree.exp
index 77cd07f..b234e44 100644
--- a/test/lib/completions/a2ps.exp
+++ b/test/lib/completions/smbtree.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "a2ps "
+assert_complete_any "smbtree -"
 
 
 sync_after_int

-- 
bash-completion



More information about the Bash-completion-commits mailing list