summaryrefslogtreecommitdiff
path: root/bash_completion
Commit message (Collapse)AuthorAgeFilesLines
* Remove verbose options from `_upvars'.use-_get_comp_words_by_refFreddy Vulto2010-06-101-16/+1
|
* Added `_upvars' and `_upvar'.Freddy Vulto2010-06-091-89/+119
| | | | These helper methods aid in passing variables by reference.
* Fix commentFreddy Vulto2010-03-141-1/+1
|
* Improve _get_comp_words_by_ref to return `words' and `cword'Freddy Vulto2010-03-141-27/+60
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Use _get_comp_words_by_ref to set cur, prev, [..] instead of manually using ↵David Paleino2010-02-081-24/+19
| | | | COMP_WORDS
* Added _get_comp_words_by_ref()Freddy Vulto2010-02-071-0/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Merge branch 'fvu'Freddy Vulto2010-01-291-20/+40
|\
| * Fix _usergroup, cpio and chown completionsFreddy Vulto2010-01-291-20/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add showmount completion (Alioth: #312285).Ildar Mulyukov2010-01-261-1/+1
|/
* Do not alias sed to gsed (Alioth: #311393).Ville Skyttä2010-01-191-4/+0
|
* Avoid use of POSIX character classes with awk for mawk compatibility.Ville Skyttä2010-01-191-2/+2
|
* Add pbzip2, pbunzip2, and pbzcat completions.Ville Skyttä2010-01-181-1/+1
|
* Make _parse_help() look at stderr too.Ville Skyttä2010-01-181-1/+1
|
* Add pigz and unpigz completion.Ville Skyttä2010-01-181-1/+1
|
* Removed awk regexp character classes.Freddy Vulto2010-01-171-1/+1
| | | | | | | | | | | 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
* Weed out look completions not starting with current word.Ville Skyttä2010-01-161-1/+1
| | | | | | | | 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.
* Fix installing simple xspec completions on systems with non-GNU sed.Ville Skyttä2010-01-161-1/+1
| | | | There's no alternation functionality ('\|' or '|') in POSIX BRE.
* Fix finding known hosts files from SSH configs on systems with non-GNU sed.Ville Skyttä2010-01-161-1/+1
| | | | There's no alternation functionality ('\|' or '|') in POSIX BRE.
* Update years in copyright notice.Ville Skyttä2010-01-141-1/+1
|
* Apply xine and friends completion also to dragon.Ville Skyttä2010-01-131-1/+1
|
* Fix _known_hosts_real: awkcurd > curdFreddy Vulto2010-01-061-1/+1
|
* sed portability fixes.Ville Skyttä2010-01-041-2/+2
| | | | Use \{0,1\} (POSIX BRE) instead of \? or empty subexpression alternatives.
* Fix some syntax errors.Ville Skyttä2010-01-031-1/+1
| | | | | | 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).
* protect against error when used in history context (COMP_CWORD=0)Guillaume Rousse2010-01-031-1/+6
|
* Do basic HTML file completion with Firefox and Chrome and friends, and Epiphany.Ville Skyttä2010-01-031-1/+2
|
* Remove/rephrase some obsolete bash 2 related comments.Ville Skyttä2010-01-031-1/+0
|
* Fix __expand_tilde_by_ref usage example.Ville Skyttä2010-01-031-1/+1
|
* Split mount and umount completion into contrib/mount.Ville Skyttä2010-01-021-69/+0
|
* Fix __reassemble_comp_words_by_ref()Freddy Vulto2009-12-311-5/+9
| | | | | Completing "a b " returned cur=b instead of cur=nothing if a wordbreak character was specified.
* Fix __reassemble_comp_words_by_ref()Freddy Vulto2009-12-301-2/+2
| | | | | | | | | 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
* Re-fix *.okular addition, this time without matching compressed ones.Ville Skyttä2009-12-281-1/+1
|
* Revert "Fix *.okular addition."David Paleino2009-12-281-1/+1
| | | | | | This reverts commit dd5134a39a25f967cbc020b8a4d15807a2f5028e. Okular doesn't open compressed .okular files.
* Fix *.okular addition.Ville Skyttä2009-12-281-1/+1
|
* Added .okular completion to okular (Debian: #545530)David Paleino2009-12-271-1/+1
|
* Fix $2 example in _get_cword doc.Ville Skyttä2009-12-241-1/+1
|
* Fixed `quote_readline'.Freddy Vulto2009-12-241-27/+106
| | | | | | | | | | 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().
* Use awk more to reduce number of invoked commands a bit.Ville Skyttä2009-12-211-3/+3
|
* Replace some echos with printfs.Ville Skyttä2009-12-211-10/+12
|
* Replace some uses of ls with printf.Ville Skyttä2009-12-201-2/+2
|
* Protect grep invocations from user aliases (Alioth: 312143).Ville Skyttä2009-12-151-4/+5
|
* Complete aliases also when there are no known hosts files (RedHat: #546905).Ville Skyttä2009-12-131-6/+8
|
* Include avahi host completions in known hosts completions no matter if we ↵Ville Skyttä2009-12-131-13/+12
| | | | have known hosts or ssh config files or not.
* Get rid of one unnecessary local variable.Ville Skyttä2009-12-131-4/+3
|
* Doc and line wrapping fixes.Ville Skyttä2009-12-131-5/+7
|
* Added .fdf completion to okular and evinceDavid Paleino2009-12-111-2/+2
|
* Don't append space after colon in _usergroup (bash 4 only).Ville Skyttä2009-12-111-0/+1
|
* Add wordbreak filtering to _count_args.Ville Skyttä2009-12-111-6/+7
|
* Fix __reassemble_comp_words_by_ref()Freddy Vulto2009-12-101-3/+3
| | | | | | | | | | | | | | If a word is made up of multiple word separator characters: $ a b::<TAB> # CWORDS are: a, b, and :: (correct) __reassemble_comp_words_by_ref() couldn't handle this. It assumed CWORDS were: $ a b::<TAB> # CWORDS: a, b, : and : (but they're not) Added test case for this. To run the automated tests: ./runUnit _get_cword.exp
* Remove unused local variable `wordbreaks'Freddy Vulto2009-12-071-3/+2
| | | | in function `__reassemble_comp_words_by_ref()'
* Merged __get_cword3 & __get_cword4 to _get_cwordFreddy Vulto2009-12-061-140/+98
| | | | | | | | | | | | | | Actually enhanced __get_cword3 to _get_cword, and removed __get_cword4. __get_cword4 could handle chars to exclude from COMP_WORDBREAKS, but failed with partial quoted arguments (e.g. "a 'b c|", | = cursor position). This was no problem till bash-4.0.35, because bash < 4.0.35 also returned partial quoted arguments incorrectly. See also: http://www.mail-archive.com/bug-bash@gnu.org/msg06094.html Now that bash-4.0.35 returns quoted arguments ok, __get_cword3 is enhanced to also handle chars to exclude from COMP_WORDBREAKS. Because __get_cword3 also handles partial quoted arguments correctly, this makes __get_cword3 suitable for bash-4 as well.