1560 Commits

Author SHA1 Message Date
Ville Skyttä
81d3c689a5 Speed up process name completion. 2010-03-30 20:49:43 +03:00
Ville Skyttä
0271e15695 Do basic text editor completion with xemacs, sxemacs, kate, and kwrite. 2010-03-24 00:33:42 +02:00
Ville Skyttä
5064875616 Remove duplicate basic pattern for emacs only, use same as other text editors. 2010-03-24 00:30:41 +02:00
Guillaume Rousse
0098435c71 rename _get_command to _get_first_arg, and move it to main file, as it is a generic utility function 2010-03-14 19:27:40 +01:00
Freddy Vulto
f894f07500 Fix comment 2010-03-14 11:21:56 +01:00
Freddy Vulto
bdca37a7bf Improve _get_comp_words_by_ref to return words' and cword'
Usage: _get_comp_words_by_ref [OPTIONS] [VARNAMES]
Available VARNAMES:
    cur         Return cur within varname "cur"
    prev        Return prev within varname "prev"
    words       Return words within varname "words"
    cword       Return cword within varname "cword"

Available OPTIONS:
    -n EXCLUDE  Characters out of $COMP_WORDBREAKS which should NOT be
                considered word breaks. This is useful for things like scp
                where we want to return host:path and not only path, so we
                would pass the colon (:) as -n option in this case.  Bash-3
                doesn't do word splitting, so this ensures we get the same
                word on both bash-3 and bash-4.
    -c VARNAME  Return cur within specified VARNAME
    -p VARNAME  Return prev within specified VARNAME
    -w VARNAME  Return words within specified VARNAME
    -i VARNAME  Return words within specified VARNAME

Example usage:

   $ _get_comp_words_by_ref -n : cur prev
2010-03-14 11:07:13 +01:00
Ville Skyttä
acfa7eef3b Simplify wine extension glob. 2010-03-12 18:16:48 +02:00
Austin English
f66e87ffb7 Make lookup of wine file completions case insensitive. 2010-03-12 18:14:57 +02:00
Freddy Vulto
caaf58859a Undo commit 00560a88 ("_filedir: bash > 4 has the same behaviour
regardless of $cur beginning with ' or not"), because this is failing
tests:

    FAIL: completing f a\'b/ should return i
    FAIL: completing f a\"b/ should return i
    FAIL: f a\$b/ should show completions
    FAIL: f a\\b/ should show completions
    FAIL: completing f2 a\'b/ should return i
    FAIL: completing f2 a\"b/ should return i
    FAIL: f2 a\$b/ should show completions
    FAIL: f2 a\\b/ should show completions

- Fix _filedir to check for availability of COMP_WORDS (_filedir runs from
  within a completion instead of the command line) when doing a `complete -p
  ${COMP_WORDS[0]'
- Fix _filedir usage comment
- Enhanced _filedir tests
- Added _filedir test "completing with filter '.e1' should show completions"
2010-03-12 13:41:53 +01:00
David Paleino
8755f716fc Merge branch 'master' of git+ssh://git.debian.org/git/bash-completion/bash-completion 2010-03-08 12:38:33 +01:00
Ville Skyttä
314cc0f13a Drop support for bash < 3.2. 2010-03-06 14:24:57 +02:00
Ville Skyttä
bc6f14445f Do basic diff/patch completion with cdiff and kompare. 2010-03-06 14:05:41 +02:00
Ville Skyttä
72a8cb5b49 Add -H, -L, and -P to chown and chgrp option completions with -R/--recursive. 2010-02-12 17:52:56 +02:00
Crestez Dan Leonard
ebdd9cefdc Merge branch 'space-fix': Fix tests when BASH_COMPLETION or TESTDIR contain
spaces.

Conflicts:
	CHANGES
2010-02-09 15:45:40 +02:00
David Paleino
91a8ed2c1d remove trailing whitespace 2010-02-09 11:08:57 +01:00
David Paleino
00560a88b4 _filedir: bash > 4 has the same behaviour regardless of $cur beginning with ' or not
This can be triggered when $cur is actually empty, like, for example, when _filedir
  is manually launched from the command line:

    $ _filedir in
    $ echo ${COMPREPLY[@]}
    test doc .git contrib

  i.e. it's only showing the directories, not showing the files we're looking for.
  After this commit:

    $ . bash_completion
    $ _filedir in
    $ echo ${COMPREPLY[@]}
    test doc .git contrib bash_completion.sh.in Makefile.in
    $

  Which is the expected behaviour.
2010-02-09 11:07:55 +01:00
Ildar Mulyukov
6b30acc9ac bind *.ltx files to LaTeX family of programs
according to user request https://bugzilla.altlinux.org/show_bug.cgi?id=22443
2010-02-08 22:14:15 +02:00
David Paleino
f8bafe285e Use _get_comp_words_by_ref to set cur, prev, [..] instead of manually using COMP_WORDS 2010-02-08 17:25:08 +01:00
Freddy Vulto
b529cee550 Added _get_comp_words_by_ref()
This solves the following problems:
- now one function call suffices instead of two (_get_cword; _get_pword) if
  subsequent words need to be retrieved.  Also more than two words can be
  retrieved at once, e.g.: _get_comp_words_by_ref cur prev prev2 prev3
  Also this prevents passing of `wordbreakchars' to differ in calls to
  `_get_cword' and `_get_pword', e.g.: _get_comp_words_by_ref -n : cur prev
- passing by reference, no subshell call necessary anymore
- _get_pword now also takes into account the cursor position

Added testsuite proc `assert_no_output()'

Word of caution:

The passing-arguments-by-ref system in bash doesn't work if the new variable is
also declared local.  For example:

    t() {
        local a
        # ...
        eval $1=b
    }
    a=c; t a; echo $a  # Outputs "c", should be "b"
                       # Variable "a" is 'forbidden'

To make name collissions like this less likely to happen, but make the real
function still use readable variables, I've wrapped the `*_by_ref'
functions within an additional layer using variables prefixed with double
underscores (__).  For example:

    _t() {
        # Readable variables can still be used here
        local a
        # ...
        eval $1=b
    }
    t() {
        local __a
        _t __a
        eval $1=\$__a
    }
    a=c; t a; echo $a  # Outputs "b"
                       # Variable "__a" is 'forbidden'

Now only more obfuscated variables (starting with double prefix (__)) are
forbidden to use.
2010-02-07 15:18:58 +01:00
Crestez Dan Leonard
c3bb4416d7 Fixed tests when BASH_COMPLETION or TESTDIR contain spaces. 2010-02-02 11:16:29 +02:00
Freddy Vulto
1061876bbc Merge branch 'fvu' 2010-01-29 23:24:58 +01:00
Freddy Vulto
d866854066 Fix _usergroup, cpio and chown completions
Improve test suite.
Thanks to Leonard Crestez (Alioth: #311396, Debian: #511788).

`assert_complete' is improved.  It proved difficult to tell tcl to ignore
backslash escapes, e.g. the `\b' is no BACKSPACE but a literal `b'.  The added
function `split_words_bash' should to the trick now.

Added function `assert_no_complete' which can also be reached by calling
`assert_complete' with an empty `expected' argument:

    assert_complete "" qwerty
2010-01-29 23:23:30 +01:00
Ildar Mulyukov
3438a5547a Add showmount completion (Alioth: #312285). 2010-01-26 23:33:24 +02:00
Ville Skyttä
ab05989877 Do not alias sed to gsed (Alioth: #311393). 2010-01-19 21:59:08 +02:00
Ville Skyttä
7914d17468 Avoid use of POSIX character classes with awk for mawk compatibility. 2010-01-19 19:09:15 +02:00
Ville Skyttä
08e746ea10 Add pbzip2, pbunzip2, and pbzcat completions. 2010-01-18 19:21:08 +02:00
Ville Skyttä
43681ffac6 Make _parse_help() look at stderr too. 2010-01-18 19:09:02 +02:00
Ville Skyttä
df1a02baa5 Add pigz and unpigz completion. 2010-01-18 18:54:39 +02:00
Freddy Vulto
2f78769d65 Removed awk regexp character classes.
On Debian/Ubuntu, awk (mawk 1.3.3 Nov 1996) is not supporting regexp
character classes.  See also:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=314323

This was causing unit test `_known_hosts_real' to fail.  To run the
test:

    ./run unit/_known_hosts_real.exp
2010-01-17 10:41:13 +01:00
Ville Skyttä
f8eec776e2 Weed out look completions not starting with current word.
Some versions of the default word list for look may return
non-completable entries (e.g. due to sort order mismatch -- dictionary
vs non-dictionary one, case sensitivity etc -- between sort order in
default word list and look's defaults).  As a side effect, fixes also
the test case when a lot of words are returned.
2010-01-16 17:30:02 +02:00
Ville Skyttä
ea0ee6a46b Fix installing simple xspec completions on systems with non-GNU sed.
There's no alternation functionality ('\|' or '|') in POSIX BRE.
2010-01-16 15:38:49 +02:00
Ville Skyttä
878c9dd5c9 Fix finding known hosts files from SSH configs on systems with non-GNU sed.
There's no alternation functionality ('\|' or '|') in POSIX BRE.
2010-01-16 15:22:49 +02:00
Ville Skyttä
1fe72c982e Update years in copyright notice. 2010-01-14 19:33:21 +02:00
Ville Skyttä
dfc8e9bb8f Apply xine and friends completion also to dragon. 2010-01-13 20:36:01 +02:00
Freddy Vulto
d5d7592169 Fix _known_hosts_real: awkcurd > curd 2010-01-06 09:31:31 +01:00
Ville Skyttä
db739401f7 sed portability fixes.
Use \{0,1\} (POSIX BRE) instead of \? or empty subexpression alternatives.
2010-01-04 18:15:10 +02:00
Ville Skyttä
2a5a1d68d9 Fix some syntax errors.
For some reason, these constructs got flagged as syntax errors at load
time with bash 4.0.33(0)-release on FreeBSD 8.0 whereas they work
elsewhere I've tested (e.g. 4.0.23(1)-release on Fedora Core 11).
2010-01-03 21:18:41 +02:00
Guillaume Rousse
2cf62de308 protect against error when used in history context (COMP_CWORD=0) 2010-01-03 19:01:56 +01:00
Ville Skyttä
aae256d7e0 Do basic HTML file completion with Firefox and Chrome and friends, and Epiphany. 2010-01-03 14:21:08 +02:00
Ville Skyttä
9c2843a956 Remove/rephrase some obsolete bash 2 related comments. 2010-01-03 14:03:38 +02:00
Ville Skyttä
86070a8f60 Fix __expand_tilde_by_ref usage example. 2010-01-03 13:50:14 +02:00
Ville Skyttä
563e4d355d Split mount and umount completion into contrib/mount. 2010-01-02 10:35:18 +02:00
Freddy Vulto
3f0bfbc5ae Fix __reassemble_comp_words_by_ref()
Completing "a b " returned cur=b instead of cur=nothing if a wordbreak
character was specified.
2009-12-31 11:12:15 +01:00
Freddy Vulto
3251038c9d Fix __reassemble_comp_words_by_ref()
On bash-3, completing a b c: with COMP_WORDBREAKS -= : would result in the
current word being bc: (Alioth #312190)

Added unit test, run via:

    ./run unit/_get_cword.exp
2009-12-30 09:43:16 +01:00
Ville Skyttä
eee39d7b66 Re-fix *.okular addition, this time without matching compressed ones. 2009-12-28 23:50:24 +02:00
David Paleino
8299cd3616 Revert "Fix *.okular addition."
This reverts commit dd5134a39a25f967cbc020b8a4d15807a2f5028e.

  Okular doesn't open compressed .okular files.
2009-12-28 21:28:16 +01:00
Ville Skyttä
dd5134a39a Fix *.okular addition. 2009-12-28 22:25:47 +02:00
David Paleino
db3c386fd3 Added .okular completion to okular (Debian: #545530) 2009-12-27 19:07:24 +01:00
Ville Skyttä
8f56de625e Fix $2 example in _get_cword doc. 2009-12-24 15:31:19 +02:00
Freddy Vulto
c9c98da36e Fixed `quote_readline'.
This fixes completing filenames containing single quote (') on bash-4.

Also added emulation of `-o filenames' to _filedir.

Added tests for _filedir.

Fixed array assignment within __reassemble_comp_words_by_ref().
2009-12-24 10:00:29 +01:00