mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +02:00
yubikey-plugin Enhancement
* Update the README.md file * Add key listing logic (auto-truncating if too long) * Some output cosmetics
This commit is contained in:
parent
304f65b537
commit
47400ebc28
2 changed files with 29 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ local _libname='opensc-pkcs11.so'
|
|||
local _sshfiledir="/run/user/$UID"
|
||||
local _sshfile='ssh_agent'
|
||||
local _sshpath=''
|
||||
local _ellipsis='......'
|
||||
|
||||
if [[ -z $OPENSC ]]; then
|
||||
for f in $(locate "/${_libname}"); do
|
||||
|
|
@ -26,20 +27,33 @@ alias yubi-insert="ssh-add -s $OPENSC"
|
|||
alias yubi-eject="ssh-add -e $OPENSC"
|
||||
|
||||
if [[ -r $_sshpath ]]; then
|
||||
echo "Common SSH Agent detected."
|
||||
echo -n "Common SSH Agent detected. "
|
||||
source $_sshpath
|
||||
else
|
||||
echo -n "Common SSH Agent not detected."
|
||||
echo -n "Common SSH Agent not detected. "
|
||||
case "${(U)YUBI_SSHAGENT_AUTOINIT}" in
|
||||
1|Y|YES)
|
||||
echo -n " Auto-initializing... "
|
||||
echo -n "Auto-initializing... "
|
||||
yubi-init
|
||||
echo "done."
|
||||
;;
|
||||
*)
|
||||
echo " Autoinit not enabled. Use 'yubi-init' to manually init."
|
||||
echo "Autoinit not enabled. Use 'yubi-init' to manually init."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case "${(U)YUBI_SHOWKEYS}" in
|
||||
1|Y|YES)
|
||||
ssh-add -L | while read ln; do
|
||||
if (( ${#ln} >= COLUMNS )); then
|
||||
newlen=$(( COLUMNS - ${#_ellipsis} - 1 ))
|
||||
halflen=$(( newlen / 2 ))
|
||||
ln="${ln:0:$halflen}${_ellipsis}${ln: -$halflen}"
|
||||
fi
|
||||
echo "$ln"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
# vim: set ft=zsh ts=4 sts=4 et ai :
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue