mirror of
https://github.com/nikdoof/dotfiles.git
synced 2025-12-14 10:12:28 +00:00
Shell updates
This commit is contained in:
@@ -12,12 +12,13 @@ function update-dotfiles() {
|
|||||||
cd $prevdir
|
cd $prevdir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Wrapper around ssh-add to ease usage and also ensure basic timeouts
|
||||||
function add-sshkey() {
|
function add-sshkey() {
|
||||||
TIMEOUT="2h"
|
TIMEOUT="2h"
|
||||||
NAME=$1
|
NAME=$1
|
||||||
|
|
||||||
if [ -z "$NAME" ]; then
|
if [ -z "$NAME" ]; then
|
||||||
echo "Current Keys"
|
echo "Current Agent Keys"
|
||||||
ssh-add -L | cut -d" " -f 3-
|
ssh-add -L | cut -d" " -f 3-
|
||||||
else
|
else
|
||||||
if [ -f "${HOME}/.ssh/id_ed25519_${NAME}" ]; then
|
if [ -f "${HOME}/.ssh/id_ed25519_${NAME}" ]; then
|
||||||
|
|||||||
18
zsh/.config/zsh/completions.zsh
Normal file
18
zsh/.config/zsh/completions.zsh
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
autoload -Uz compinit
|
||||||
|
compinit
|
||||||
|
|
||||||
|
function _add-sshkey(){
|
||||||
|
local -a identities
|
||||||
|
|
||||||
|
# check for .ssh folder presence
|
||||||
|
if [[ ! -d $HOME/.ssh ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
for id in $HOME/.ssh/id_ed25519_*; do
|
||||||
|
name=$(basename $id|cut -d'_' -f3|cut -d'.' -f1)
|
||||||
|
[[ ${id:-3} != 'pub' ]] && identities+=$name
|
||||||
|
done
|
||||||
|
|
||||||
|
compadd $identities
|
||||||
|
}
|
||||||
|
compdef _add-sshkey add-sshkey
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
# Source shell common
|
# Source shell common
|
||||||
for f in ~/.config/shell-common/*.sh; do
|
for f in ~/.config/shell-common/*.sh; do
|
||||||
source $f;
|
source $f;
|
||||||
|
|||||||
Reference in New Issue
Block a user