-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bind: Add option and argument (non-)completions
- Loading branch information
Showing
5 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ bashcomp_DATA = 2to3 \ | |
autoscan \ | ||
avctrl \ | ||
badblocks \ | ||
bind \ | ||
bk \ | ||
brctl \ | ||
btdownloadheadless.py \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# bash bind completion -*- shell-script -*- | ||
|
||
_bind() | ||
{ | ||
local cur prev words cword | ||
_init_completion || return | ||
|
||
case $prev in | ||
-l|-p|-P|-s|-S|-v|-V|-r|-x|-X) | ||
return | ||
;; | ||
-m) | ||
COMPREPLY=( $( compgen -W "emacs emacs-standard emacs-meta | ||
emacs-ctlx vi vi-move vi-command vi-insert" -- "$cur" ) ) | ||
return | ||
;; | ||
-f) | ||
_filedir | ||
return | ||
;; | ||
-q|-u) | ||
COMPREPLY=( $( compgen -W '$( "$1" -l )' -- "$cur" ) ) | ||
return | ||
;; | ||
esac | ||
|
||
if [[ "$cur" == -* ]]; then | ||
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) | ||
return | ||
fi | ||
|
||
COMPREPLY=( $( compgen -A binding -- "$cur" ) ) | ||
} && | ||
complete -F _bind bind | ||
|
||
# ex: filetype=sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
assert_source_completions bind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
proc setup {} { | ||
save_env | ||
} | ||
|
||
|
||
proc teardown {} { | ||
assert_env_unmodified | ||
} | ||
|
||
|
||
setup | ||
|
||
|
||
assert_complete_any "bind -" | ||
sync_after_int | ||
|
||
assert_complete_any "bind k" | ||
sync_after_int | ||
|
||
|
||
teardown |