[Bash-completion-commits] Re
You've earned £1,350,000. Necessary information:name,age,country mrselizabeth.dani...@btinternet.com ___ Bash-completion-commits mailing list Bash-completion-commits@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits
[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 4fce53700073a9d65ebd20ac5756068fae32bc38
The following commit has been merged in the master branch: commit d8bb766fbe3b03b0decd110e9bfd0b16dc594431 Author: Guillaume Rousse guillomovi...@zarb.org Date: Sat May 2 16:11:23 2009 +0200 standardize ssh completion scheme: - complete after previous unstacked short options - complete potential options after dash - complete on known host if neither apply diff --git a/contrib/ssh b/contrib/ssh index 85325aa..2aebe62 100644 --- a/contrib/ssh +++ b/contrib/ssh @@ -17,39 +17,49 @@ _ssh() case $prev in -F) _filedir + return 0 ;; - -*c) + -c) COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \ arcfour cast128-cbc' -- $cur ) ) + return 0 ;; - -*i) + -i) _filedir + return 0 ;; - -*l) + -l) COMPREPLY=( $( compgen -u -- $cur ) ) + return 0 ;; - *) - # Search COMP_WORDS for '-F configfile' argument - set -- ${comp_wor...@]} - while [ $# -gt 0 ]; do - if [ ${1:0:2} = -F ]; then - if [ ${#1} -gt 2 ]; then - optconfigfile=$(dequote $1) - else - shift - [ $1 ] optconfigfile=$(dequote -F$1) - fi - break - fi - shift - done - - _known_hosts -a $optconfigfile - - [ $COMP_CWORD -eq 1 -o -n $optconfigfile ] || \ - COMPREPLY=( ${comprep...@]} $( compgen -c -- $cur ) ) esac + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \ + -N -n -q -s -T -t -V -v -X -v -Y -y -b -b -c -D -e -F \ + -i -L -l -m -O -o -p -R -S -w' -- $cur ) ) + else + if [ $COMP_CWORD -eq 1 ]; then + # Search COMP_WORDS for '-F configfile' argument + set -- ${comp_wor...@]} + while [ $# -gt 0 ]; do + if [ ${1:0:2} = -F ]; then + if [ ${#1} -gt 2 ]; then + optconfigfile=$(dequote $1) + else + shift + [ $1 ] optconfigfile=$(dequote -F$1) + fi + break + fi + shift + done + _known_hosts -a $optconfigfile + else + COMPREPLY=( ${comprep...@]} $( compgen -c -- $cur ) ) + fi + fi + return 0 } shopt -u hostcomplete complete -F _ssh ssh slogin sftp xhost autossh -- bash-completion ___ Bash-completion-commits mailing list Bash-completion-commits@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits
[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 4fce53700073a9d65ebd20ac5756068fae32bc38
The following commit has been merged in the master branch: commit 4692a4b14ac8edff31f7d9a2da53ba3a11ad1f02 Author: Guillaume Rousse guillomovi...@zarb.org Date: Sat May 2 16:20:31 2009 +0200 more option completions diff --git a/contrib/ssh b/contrib/ssh index 2aebe62..68586a4 100644 --- a/contrib/ssh +++ b/contrib/ssh @@ -15,23 +15,57 @@ _ssh() prev=${COMP_WORDS[COMP_CWORD-1]} case $prev in - -F) + -@(F|i|S)) _filedir return 0 ;; -c) - COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \ - arcfour cast128-cbc' -- $cur ) ) + COMPREPLY=( $( compgen -W '3des-cbc aes128-cbc aes192-cbc \ + aes256-cbc aes128-ctr aes192-ctr aes256-ctr arcfour128 \ + arcfour256 arcfour blowfish-cbc cast128-cbc' -- $cur ) ) return 0 ;; - -i) - _filedir + -c) + COMPREPLY=( $( compgen -W 'hmac-md5 hmac-sha1 umac...@openssh.com \ + hmac-ripemd160 hmac-sha1-96 hmac-md5-96' -- $cur ) ) return 0 ;; -l) COMPREPLY=( $( compgen -u -- $cur ) ) return 0 ;; + -o) + COMPREPLY=( $( compgen -W 'AddressFamily BatchMode BindAddress \ + ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \ + ClearAllForwardings Compression CompressionLevel \ + ConnectionAttempts ConnectTimeout ControlMaster ControlPath \ + DynamicForward EscapeChar ExitOnForwardFailure ForwardAgent \ + ForwardX11 ForwardX11Trusted GatewayPorts GlobalKnownHostsFile \ + GSSAPIAuthentication GSSAPIDelegateCredentials HashKnownHosts \ + Host HostbasedAuthentication HostKeyAlgorithms HostKeyAlias \ + HostName IdentityFile IdentitiesOnly KbdInteractiveDevices \ + LocalCommand LocalForward LogLevel MACs \ + NoHostAuthenticationForLocalhost NumberOfPasswordPrompts \ + PasswordAuthentication PermitLocalCommand Port \ + PreferredAuthentications Protocol ProxyCommand \ + PubkeyAuthentication RekeyLimit RemoteForward \ + RhostsRSAAuthentication RSAAuthentication SendEnv \ + ServerAliveInterval ServerAliveCountMax SmartcardDevice \ + StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \ + UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \ + VisualHostKey XAuthLocation' -- $cur ) ) + return 0 + ;; + -w) + _available_interfaces + return 0 + ;; + -b) + COMPREPLY=( $( compgen -W $(/sbin/ifconfig | \ + awk '/adr:/ {print $2}' | \ + awk -F: '{print $2}' ) -- $cur ) ) + return 0 + ;; esac if [[ $cur == -* ]]; then -- bash-completion ___ Bash-completion-commits mailing list Bash-completion-commits@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits
[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 4fce53700073a9d65ebd20ac5756068fae32bc38
The following commit has been merged in the master branch: commit 39a143e08323ed153d7389cadf6dce75e4a68ce5 Author: Guillaume Rousse guillomovi...@zarb.org Date: Sat May 2 17:13:46 2009 +0200 split xhost completion in its own file diff --git a/contrib/ssh b/contrib/ssh index 68586a4..5296ad6 100644 --- a/contrib/ssh +++ b/contrib/ssh @@ -96,7 +96,7 @@ _ssh() return 0 } -shopt -u hostcomplete complete -F _ssh ssh slogin sftp xhost autossh +shopt -u hostcomplete complete -F _ssh ssh slogin sftp autossh # scp(1) completion # diff --git a/contrib/xhost b/contrib/xhost new file mode 100644 index 000..7ed3c79 --- /dev/null +++ b/contrib/xhost @@ -0,0 +1,34 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# xhost(1) completion +# +have xhost +_xhost () +{ + local cur i + cur=`_get_cword` + + case $cur in + +*) + cur=${cur:1} + _known_hosts -h $cur + for (( i=0; i ${#comprep...@]}; i++ )); do + COMPREPLY[i]=+${COMPREPLY[i]} + done + ;; + -*) + cur=${cur:1} + _known_hosts -h $cur + for (( i=0; i ${#comprep...@]}; i++ )); do + COMPREPLY[i]=-${COMPREPLY[i]} + done + ;; + *) + _known_hosts -h $cur + ;; + esac + + return 0 +} +complete -F _xhost xhost -- bash-completion ___ Bash-completion-commits mailing list Bash-completion-commits@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits
[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 4fce53700073a9d65ebd20ac5756068fae32bc38
The following commit has been merged in the master branch: commit 5decc1de0480cef1648a30864a3b894867fc5c97 Author: Guillaume Rousse guillomovi...@zarb.org Date: Sat May 2 17:23:21 2009 +0200 standard completion scheme for ssh-copy-id diff --git a/contrib/ssh b/contrib/ssh index c6cedae..f30db98 100644 --- a/contrib/ssh +++ b/contrib/ssh @@ -179,16 +179,18 @@ _ssh_copy_id() { prev=${COMP_WORDS[COMP_CWORD-1]} case $prev in - -*i) - _filedir - ;; - *) - _known_hosts -a - - [ $COMP_CWORD -eq 1 ] || \ - COMPREPLY=( ${comprep...@]} $( compgen -- $cur ) ) + -i) + _filedir + return 0 + ;; esac + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '-i' -- $cur ) ) + else + _known_hosts -a + fi + return 0 } complete -F _ssh_copy_id $filenames ssh-copy-id -- bash-completion ___ Bash-completion-commits mailing list Bash-completion-commits@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits
[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 4fce53700073a9d65ebd20ac5756068fae32bc38
The following commit has been merged in the master branch: commit ae757e453b427372bfe7eaf60b139000668f8398 Author: Guillaume Rousse guillomovi...@zarb.org Date: Sat May 2 17:34:00 2009 +0200 distinct completion function for sftp diff --git a/contrib/ssh b/contrib/ssh index f30db98..032ad78 100644 --- a/contrib/ssh +++ b/contrib/ssh @@ -4,6 +4,29 @@ # ssh(1) completion # have ssh { + +_ssh_options() { + COMPREPLY=( $( compgen -W 'AddressFamily BatchMode BindAddress \ + ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \ + ClearAllForwardings Compression CompressionLevel \ + ConnectionAttempts ConnectTimeout ControlMaster ControlPath \ + DynamicForward EscapeChar ExitOnForwardFailure ForwardAgent \ + ForwardX11 ForwardX11Trusted GatewayPorts GlobalKnownHostsFile \ + GSSAPIAuthentication GSSAPIDelegateCredentials HashKnownHosts \ + Host HostbasedAuthentication HostKeyAlgorithms HostKeyAlias \ + HostName IdentityFile IdentitiesOnly KbdInteractiveDevices \ + LocalCommand LocalForward LogLevel MACs \ + NoHostAuthenticationForLocalhost NumberOfPasswordPrompts \ + PasswordAuthentication PermitLocalCommand Port \ + PreferredAuthentications Protocol ProxyCommand \ + PubkeyAuthentication RekeyLimit RemoteForward \ + RhostsRSAAuthentication RSAAuthentication SendEnv \ + ServerAliveInterval ServerAliveCountMax SmartcardDevice \ + StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \ + UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \ + VisualHostKey XAuthLocation' -- $cur ) ) +} + _ssh() { local cur prev @@ -37,32 +60,7 @@ _ssh() return 0 ;; -o) - COMPREPLY=( $( compgen -W 'AddressFamily BatchMode \ - BindAddress ChallengeResponseAuthentication \ - CheckHostIP Cipher Ciphers ClearAllForwardings \ - Compression CompressionLevel \ - ConnectionAttempts ConnectTimeout \ - ControlMaster ControlPath DynamicForward \ - EscapeChar ExitOnForwardFailure ForwardAgent \ - ForwardX11 ForwardX11Trusted GatewayPorts \ - GlobalKnownHostsFile GSSAPIAuthentication \ - GSSAPIDelegateCredentials HashKnownHosts Host \ - HostbasedAuthentication HostKeyAlgorithms \ - HostKeyAlias HostName IdentityFile \ - IdentitiesOnly KbdInteractiveDevices \ - LocalCommand LocalForward LogLevel MACs \ - NoHostAuthenticationForLocalhost \ - NumberOfPasswordPrompts PasswordAuthentication \ - PermitLocalCommand Port \ - PreferredAuthentications Protocol \ - ProxyCommand PubkeyAuthentication RekeyLimit \ - RemoteForward RhostsRSAAuthentication \ - RSAAuthentication SendEnv ServerAliveInterval \ - ServerAliveCountMax SmartcardDevice \ - StrictHostKeyChecking TCPKeepAlive Tunnel \ - TunnelDevice UsePrivilegedPort User \ - UserKnownHostsFile VerifyHostKeyDNS \ - VisualHostKey XAuthLocation' -- $cur ) ) + _ssh_options return 0 ;; -w) @@ -105,7 +103,55 @@ _ssh() return 0 } -shopt -u hostcomplete complete -F _ssh ssh slogin sftp autossh +shopt -u hostcomplete complete -F _ssh ssh slogin autossh + +# sftp(1) completion +# +_sftp() +{ + local cur prev + local optconfigfile + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -@(b|F|P)) + _filedirs + return 0 + ;; + -o) + _ssh_options + return 0 + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' \ + -- $cur ) ) + else + # Search COMP_WORDS for '-F configfile' argument + set -- ${comp_wor...@]} + while [ $# -gt 0 ]; do + if [ ${1:0:2} = -F ]; then + if [ ${#1} -gt 2 ]; then +
[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 4fce53700073a9d65ebd20ac5756068fae32bc38
The following commit has been merged in the master branch: commit d5fd1c34120c6bae2cf459e386aa08c6bc7ad223 Author: Guillaume Rousse guillomovi...@zarb.org Date: Sun May 3 15:18:31 2009 +0200 split _known_hosts into _kwnown_hosts and _known_hosts_real, instead of using an option to set current word diff --git a/bash_completion b/bash_completion index f5fcba9..146b412 100644 --- a/bash_completion +++ b/bash_completion @@ -2704,28 +2704,31 @@ shopt -u hostcomplete complete -F _user_at_host $nospace talk ytalk finger # -h host Complete on given host _known_hosts() { + local cur + + COMPREPLY=() + cur=`_get_cword` + + _known_hosts_real $@ +} + +_known_hosts_real() +{ local configfile - local cur curd ocur user suffix aliases global_kh user_kh hosts i host + local curd ocur user suffix aliases global_kh user_kh hosts i host local -a kh khd config local IFS=$'\n' local OPTIND=1 - local cur_set=0 - while getopts acF:h: flag $@; do + while getopts acF: flag $@; do case $flag in a) aliases='yes' ;; c) suffix=':' ;; F) configfile=$OPTARG ;; - h) cur=$OPTARG; cur_set=1 ;; esac done - COMPREPLY=() - if [ $cur_set = 0 ]; then - cur=`_get_cword` - fi ocur=$cur - [[ $cur == *...@* ]] user=${c...@*}@ cur=${cu...@} kh=() diff --git a/contrib/ssh b/contrib/ssh index 032ad78..a445c8a 100644 --- a/contrib/ssh +++ b/contrib/ssh @@ -95,7 +95,7 @@ _ssh() fi shift done - _known_hosts -a $optconfigfile + _known_hosts_real -a $optconfigfile else COMPREPLY=( ${comprep...@]} $( compgen -c -- $cur ) ) fi @@ -145,7 +145,7 @@ _sftp() fi shift done - _known_hosts -a $optconfigfile + _known_hosts_real -a $optconfigfile fi return 0 @@ -201,7 +201,7 @@ _scp() shift done - [[ $cur == */* ]] || _known_hosts -c -a $optconfigfile + [[ $cur == */* ]] || _known_hosts_real -c -a $optconfigfile # This approach is used instead of _filedir to get a space appended # after local file/dir completions, and $nospace retained for others. @@ -234,7 +234,7 @@ _ssh_copy_id() { if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '-i' -- $cur ) ) else - _known_hosts -a + _known_hosts_real -a fi return 0 diff --git a/contrib/xhost b/contrib/xhost index 7ed3c79..04c12c2 100644 --- a/contrib/xhost +++ b/contrib/xhost @@ -12,20 +12,20 @@ _xhost () case $cur in +*) cur=${cur:1} - _known_hosts -h $cur + _known_hosts_real for (( i=0; i ${#comprep...@]}; i++ )); do COMPREPLY[i]=+${COMPREPLY[i]} done ;; -*) cur=${cur:1} - _known_hosts -h $cur + _known_hosts_real for (( i=0; i ${#comprep...@]}; i++ )); do COMPREPLY[i]=-${COMPREPLY[i]} done ;; *) - _known_hosts -h $cur + _known_hosts_real ;; esac -- bash-completion ___ Bash-completion-commits mailing list Bash-completion-commits@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits
[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 4fce53700073a9d65ebd20ac5756068fae32bc38
The following commit has been merged in the master branch: commit 4fce53700073a9d65ebd20ac5756068fae32bc38 Author: Guillaume Rousse guillomovi...@zarb.org Date: Tue May 5 22:40:49 2009 +0200 document changes diff --git a/CHANGES b/CHANGES index 2ff36f3..2f5fb47 100644 --- a/CHANGES +++ b/CHANGES @@ -58,6 +58,10 @@ bash-completion (1.x) [ Guillaume Rousse ] * Split mkinitrd completion to contrib/mkinitrd, improve it. * Split smartctl completion to contrib/smartctl. + * Better ssh and sftp completion + * Better xhost completion + * Split _known_hosts completion in two parts, to avoid parsing command line +twice [ Raphaël Droz ] * Add mount -L and -U completion. -- bash-completion ___ Bash-completion-commits mailing list Bash-completion-commits@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits