47 Commits

Author SHA1 Message Date
Guillaume Rousse
ed3a2f7786 use _get_pword 2010-01-03 19:01:26 +01:00
Guillaume Rousse
f2041ce0e4 no need to quote case argument nor targets 2009-12-30 00:39:59 +01:00
Ville Skyttä
000cae95bc Add dir-only handling to scp remote/local completion functions, operate directly on $cur. 2009-12-26 16:19:24 +02:00
Ville Skyttä
329890a73b Extract scp local/remote file treatment into functions, reuse them in rsync. 2009-12-25 12:30:01 +02:00
Ville Skyttä
894c877827 Add scp option completion. 2009-12-25 11:57:33 +02:00
Ville Skyttä
e0acaf8ed2 Split sshfs from contrib/ssh to contrib/sshfs. 2009-12-24 16:18:27 +02:00
Ville Skyttä
e308b07526 Add ssh -o BindAddress suboption completion. 2009-12-24 16:00:34 +02:00
Ville Skyttä
7c4de4a3ca Use the usual (local) $prev and $cur in _ssh_suboption. 2009-12-24 15:57:43 +02:00
Ville Skyttä
b56e45eaac Eliminate some duplicate code. 2009-12-24 15:52:05 +02:00
Leonard Crestez
92e7b73564 Improve ssh -o suboption completion (Alioth: #312122). 2009-12-24 15:45:19 +02:00
Ville Skyttä
e24f69aac3 Fix ssh -m completion. 2009-11-28 12:47:48 +02:00
Ville Skyttä
97e3778cb2 Code cleanups, indentation and line wrapping fixes, comment improvements. 2009-11-28 12:47:48 +02:00
Ville Skyttä
c948a3d411 Reuse "esc" more in scp escaping. 2009-11-28 12:47:48 +02:00
Ville Skyttä
3a44188d52 Fix scp completion for paths containing other backslash escaped chars besides spaces. 2009-11-28 12:47:48 +02:00
Ville Skyttä
ff0f741dcf Fix completion of remote scp filenames with spaces.
Backslash escaping adds 3 backslashes, of which we want to remove 2,
not 4 when unescaping.
2009-11-28 12:47:48 +02:00
Freddy Vulto
4230265870 Fix completion of filenames containing colon.
This fixes the auto tests for `finger' and `ssh' on machines where an IPv6 host
"::1" is mentioned in /etc/hosts.
Added helper function __ltrim_colon_completions.

To run the tests:

    ./runCompletion finger.exp ssh.exp
2009-11-22 22:22:35 +01:00
David Paleino
8f42adfa8d Style policy: don't use fancy globbing in case labels 2009-11-22 11:43:26 +01:00
Ville Skyttä
d062d3b570 Fix "adr" typo in ssh -b completion, use one sed instead of two awk calls. 2009-10-31 14:24:01 +02:00
Ville Skyttä
503c224899 Don't hardcode path to ifconfig. 2009-10-31 14:16:39 +02:00
Ville Skyttä
885e6dd6b6 Drop internal uses of $default, $filenames and friends.
Definitions are still present though, tentatively scheduled for
removal as of 2.0.
2009-10-22 12:04:29 +03:00
Ville Skyttä
0b970c7477 Indentation fixes. 2009-10-19 21:24:25 +03:00
Guillaume Rousse
506e1cb3eb new indentation policy 2009-10-04 19:42:50 +02:00
Ville Skyttä
369980bf93 Tell *Emacs to indent comments (sh-indent-comment: t).
Also move indentation settings to end of files and expand *Emacs ones to
local variables block to avoid overflowing 80 char lines.
2009-10-01 20:54:51 +03:00
Freddy Vulto
cfcf9fae8f Quote unquoted $cur to prevent globbing.
Closes Alioth #311614

Globbing might occur if $cur contains one of these globbing characters: * ? [ ]

The bug becomes apparent:

On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):

    MS-DOS style path detected: ...
    Preferred POSIX equivalent is: ...
    CYGWIN environment variable option "nodosfilewarning" turns off this warning.
    Consult the user's guide for more details about POSIX paths:
      http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.

Steps to reproduce on Linux using `strace':

Environment:  Linux, bash-completion-1.0

1.  Start bash with bash-completion loaded and find out PID ($$):

    $ echo $$
    MYPID

2.  In a second bash shell, `strace' the above PID:

    $ strace -e trace=open -f -o strace.log -p MYPID

3.  Within the first bash shell, type:

    $ cur="?"; _kernel_versions

4.  In the second bash shell, type ^C to quick `strace'.

5.  Check `strace.log', here you can see bash accessing
    something it shouldn't:

    ...
    open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
    ...

6.  The above call to `open' disappears if $cur in _kernel_versions gets
    quoted, and you repeat the steps above:

    _kernel_versions()
    {
        COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
    }
2009-09-25 09:36:29 +02:00
David Paleino
796a7f4e37 Added sshfs completion (shares the same as scp) (Debian: #545978) 2009-09-16 14:23:22 +02:00
Freddy Vulto
532f0a0e3f Fixed ssh/scp/sftp -F completions
- -F<TAB> (without a space) now also completes.
- Fixed error when completion -F with file containing spaces
- Call _filedir instead of _filedirs in sftp

NOTE: Because the ssh & sftp completions don't have `-o filenames' in
effect, _filedir won't escape spaces in filenames.  This can be seen in
the tests as "expected failures (XFAIL)".  See also:
http://lists.alioth.debian.org/pipermail/bash-completion-devel/2009-July/001766.html

To run the tests:

    cd test && ./runCompletion ssh.exp scp.exp sftp.exp
2009-07-31 12:16:45 +02:00
Freddy Vulto
25e4eb6df3 Gave _known_hosts_real mandatory argument CWORD
The option `-h hostname' to `_known_hosts_real' is removed.
2009-07-03 22:28:13 +02:00
Freddy Vulto
127eaafb54 Fixed calls to _known_hosts_real
Made _known_hosts_real raise error if there are unprocessed arguments.
2009-06-18 21:51:01 +02:00
Freddy Vulto
cdf0e82686 Fix contrib/ssh command completion
Only complete with command names (compgen -c) if argc > 1
2009-06-17 23:45:00 +02:00
Freddy Vulto
0b19577ed9 Added -h HOST option to _known_hosts_real
Modified call to _known_hosts_real in ssh, vncviewer and xhost completions.
2009-06-13 08:38:52 +02:00
Freddy Vulto
e847d57e50 Improved test suite from bash-completion-lib
Run the tests with:
$ cd test
$ ./runCompletionUnit
$ ./runCompletionCompletion

The last test of unit/_known_hosts gives UNRESOLVED and needs fixing.
2009-06-09 22:49:53 +02:00
Guillaume Rousse
d5fd1c3412 split _known_hosts into _kwnown_hosts and _known_hosts_real, instead of using an option to set current word 2009-05-03 15:18:31 +02:00
Guillaume Rousse
ae757e453b distinct completion function for sftp 2009-05-02 17:34:00 +02:00
Guillaume Rousse
5decc1de04 standard completion scheme for ssh-copy-id 2009-05-02 17:23:21 +02:00
Guillaume Rousse
41746f0bcc fix indentation 2009-05-02 17:20:41 +02:00
Guillaume Rousse
39a143e083 split xhost completion in its own file 2009-05-02 17:13:46 +02:00
Guillaume Rousse
4692a4b14a more option completions 2009-05-02 16:20:31 +02:00
Guillaume Rousse
d8bb766fbe standardize ssh completion scheme:
- complete after previous unstacked short options
- complete potential options after dash
- complete on known host if neither apply
2009-05-02 16:11:23 +02:00
Ville Skyttä
2595b32439 Add comments about local file completion of _scp. 2009-02-06 23:22:29 +02:00
Ville Skyttä
7ee70294ba NFC: fix indentation, trim trailing whitespace. 2009-01-23 01:18:28 +02:00
Ville Skyttä
eb1c298f8f scp metachar escaping fixes: remove duplicate '&' (always there), escape '!' (broken in r1082) 2009-01-23 01:12:32 +02:00
Ville Skyttä
4a360233d2 Do not make vi and friends expand tabs with spaces. 2009-01-17 11:38:33 +02:00
Ville Skyttä
c353789983 Add/compact *Emacs, vi and friends indentation etc settings. 2009-01-14 22:17:14 +02:00
David Paleino
ed7e461ed1 Allow configfile to contain spaces 2008-11-08 09:45:31 +01:00
David Paleino
39f96af59a Added support for `-F configfile' to _known_hosts(), ssh, scp and
sftp, thanks to Freddy Vulto (Closes: #504141)
2008-11-01 12:25:38 +01:00
David Paleino
886a6fdb50 Fixed ssh-copy-id completion 2008-10-24 19:19:37 +02:00
David Paleino
2df67cecb4 Moved ssh completion to separate file. 2008-09-27 12:58:42 +02:00