git://git.iain.cx/iain
/
profile.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added kill_known_host script and completion.
[profile.git]
/
.profile.d
/
completion.bashrc
diff --git
a/.profile.d/completion.bashrc
b/.profile.d/completion.bashrc
index
ad072bf
..
663b56d
100644
(file)
--- a/
.profile.d/completion.bashrc
+++ b/
.profile.d/completion.bashrc
@@
-10,7
+10,7
@@
function _generic_completion() {
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
- HOSTS="$(find $COMPLETION_DIR -type f -perm -100 | sed 's@.*/@@')"
+ HOSTS="$(find $COMPLETION_DIR -type f -perm -100
2>/dev/null
| sed 's@.*/@@')"
COMPREPLY=($(compgen -W "$HOSTS" -- "$cur"))
return 0
COMPREPLY=($(compgen -W "$HOSTS" -- "$cur"))
return 0
@@
-26,11
+26,21
@@
function _process() {
return 0
}
return 0
}
+# Host completion for SSH known hosts.
+function _known_hosts() {
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ HOSTS=$(sed 's/[ ].*//;s/,/\n/' ~/.ssh/known_hosts)
+
+ COMPREPLY=($(compgen -W "$HOSTS" -- "$cur"))
+ return 0
+}
+
# Process completion for kill, strace etc.
function _pid() {
cur=${COMP_WORDS[COMP_CWORD]}
# Process completion for kill, strace etc.
function _pid() {
cur=${COMP_WORDS[COMP_CWORD]}
- PROCESSES="$(find /proc -name '[0-9]*' -maxdepth 1 | sed 's@.*/@@')"
+ PROCESSES="$(find /proc -name '[0-9]*' -maxdepth 1
2>/dev/null
| sed 's@.*/@@')"
COMPREPLY=($(compgen -W "$PROCESSES" -- "$cur"))
return 0
COMPREPLY=($(compgen -W "$PROCESSES" -- "$cur"))
return 0
@@
-83,3
+93,4
@@
complete -F _make make
complete -F _process killall
complete -F _pid kill
complete -F _pid strace
complete -F _process killall
complete -F _pid kill
complete -F _pid strace
+complete -F _known_hosts kill_known_host