# bash completion for samba -*- shell-script -*- proc _samba_resolve_order { setglobal COMPREPLY = ''( $( compgen -W 'lmhosts host wins bcast' -- "$cur" ) ) } proc _samba_domains { if [[ -n ${COMP_SAMBA_SCAN:-} ]] { setglobal COMPREPLY = ''( $( compgen -W '$( smbtree -N -D )' -- "$cur" ) ) } } proc _samba_hosts { if [[ -n ${COMP_SAMBA_SCAN:-} ]] { setglobal COMPREPLY = ''( $( compgen -W "$( smbtree -N -S | \ sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' \ )" -- "$cur" ) ) } } proc _samba_debuglevel { setglobal COMPREPLY = ''( $( compgen -W '{0..10}' -- "$cur" ) ) } proc _samba_sockopts { setglobal COMPREPLY = ''( $( compgen -W 'SO_KEEPALIVE SO_REUSEADDR SO_BROADCAST TCP_NODELAY IPTOS_LOWDELAY IPTOS_THROUGHPUT SO_SNDBUF SO_RCVBUF SO_SNDLOWAT SO_RCVLOWAT' -- "$cur" ) ) } proc _samba_signing { setglobal COMPREPLY = ''( $( compgen -W 'on off required' -- "$cur" ) ) } proc _smbclient { local cur prev words cword split _init_completion -s || return match $prev { with -R|--name-resolve _samba_resolve_order return 0 with -t setglobal COMPREPLY = ''( $( compgen -W 'SJIS EUC JIS7 JIS8 JUNET HEX CAP' \ -- "$cur" ) ) return 0 with -s|--configfile|-A|--authentication-file _filedir return 0 with -l|--log-basename|-D|--directory _filedir -d return 0 with -O|--socket-options _samba_sockopts return 0 with -T setglobal COMPREPLY = ''( $( compgen -W 'c x I X F b g q r N a' -- "$cur" ) ) return 0 with -W|--workgroup _samba_domains return 0 with -d|--debuglevel _samba_debuglevel return 0 with -L|--list _samba_hosts return 0 with -S|--signing _samba_signing return 0 with -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 with -\?|--help|-V|--version # all other arguments are noop with these return 0 } $split && return 0 if [[ "$cur" == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } } && complete -F _smbclient smbclient proc _smbget { local cur prev words cword split _init_completion -s || return match $prev { with -o|--outputfile|-f|--rcfile _filedir return 0 with -d|--debuglevel _samba_debuglevel return 0 with -w|--workgroup _samba_domains return 0 with -u|--username|-p|--password|-b|--blocksize return 0 } $split && return 0 if [[ "$cur" == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } } && complete -F _smbget smbget proc _smbcacls { local cur prev words cword split _init_completion -s || return match $prev { with -s|--configfile|-A|--authentication-file _filedir return 0 with -l|--log-basename _filedir -d return 0 with -d|--debuglevel _samba_debuglevel return 0 with --signing _samba_signing return 0 with -O|--socket-options _samba_sockopts return 0 with -W|--workgroup _samba_domains return 0 with -\?|--help|--usage|-D|--delete|-M|--modify|-a|--add|-S|--set|-C|\ --chown|-G|--chgrp|-n|--netbiosname|-i|--scope|-U|--user return 0 } $split && return 0 if [[ "$cur" == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } } && complete -F _smbcacls smbcacls proc _smbcquotas { local cur prev words cword split _init_completion -s || return match $prev { with -s|--configfile|-A|--authentication-file _filedir return 0 with -l|--log-basename _filedir -d return 0 with -d|--debuglevel _samba_debuglevel return 0 with --signing _samba_signing return 0 with -\?|--help|--usage|-U|-u|--user|-S|--set return 0 } $split && return 0 if [[ "$cur" == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } } && complete -F _smbcquotas smbcquotas proc _smbpasswd { local cur prev words cword _init_completion || return match $prev { with -r _samba_hosts return 0 with -R _samba_resolve_order return 0 with -c _filedir return 0 with -D _samba_debuglevel return 0 with -U|-h|-w return 0 } if [[ "$cur" == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) } } && complete -F _smbpasswd smbpasswd proc _smbtar { local cur prev words cword _init_completion || return match $prev { with -r|-t _filedir tar return 0 with -s _samba_hosts return 0 with -l _samba_debuglevel return 0 with -N _filedir return 0 with -p|-x|-b|-d|-u return 0 } if [[ "$cur" == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) } } && complete -F _smbtar smbtar proc _smbtree { local cur prev words cword split _init_completion -s || return match $prev { with -s|--configfile|-A|--authentication-file _filedir return 0 with -l|--log-basename _filedir -d return 0 with -d|--debuglevel _samba_debuglevel return 0 with -S|--signing _samba_signing return 0 with -\?|--help|--usage|-U|--user return 0 } $split && return 0 if [[ "$cur" == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } } && complete -F _smbtree smbtree # ex: ts=4 sw=4 et filetype=sh