Mercurial > hg > zsh-env
comparison completion/_ssh-add @ 99:a081e7a3977d
Add support for custom completions to zshrc. Add a completion function to match all ssh keys in ~/.ssh when using ssh-add.
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Tue, 18 Oct 2016 04:25:48 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
98:ab0d075236e0 | 99:a081e7a3977d |
---|---|
1 #compdef ssh-add | |
2 | |
3 _ssh-add() { | |
4 local -a keys | |
5 for key in $HOME/.ssh/*; do | |
6 # only accept files that do not end in .pub | |
7 if [[ ${key#*.pub} == "$key" ]]; then | |
8 # exclude files that are not ssh keys | |
9 if [[ ${key#*/config} == "$key" && ${key#*/known_hosts} == "$key" ]]; then | |
10 keys+=($key) | |
11 fi | |
12 fi | |
13 done | |
14 compadd "$@" $keys | |
15 } | |
16 | |
17 _ssh-add "$@" |