Fix add-sshkey auto completions for keys with multiple underscores in them

This commit is contained in:
2023-11-15 00:21:26 +00:00
parent ff99ce4b02
commit b7537182e1

View File

@@ -9,10 +9,11 @@ function _add-sshkey() {
return
fi
for id in $HOME/.ssh/id_ed25519_*; do
name=$(basename $id | cut -d'_' -f3 | cut -d'.' -f1)
name=$(basename $id | cut -d'_' -f3- | cut -d'.' -f1)
[[ ${id:-3} != 'pub' ]] && identities+=$name
done
compadd $identities
}
compdef _add-sshkey add-sshkey