28 Commits

Author SHA1 Message Date
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