feat(zsh): add ssh-menu and run shmft
This commit is contained in:
parent
a9fe95254a
commit
d7f8b52c98
|
@ -1,9 +1,8 @@
|
||||||
alias s="ssh"
|
|
||||||
alias z="exec zsh"
|
alias z="exec zsh"
|
||||||
alias t="tmux a || tmux new-session -s $(whoami) -c ~"
|
alias t="tmux a || tmux new-session -s $(whoami) -c ~"
|
||||||
alias n=nvim_ve
|
alias n=nvim_ve
|
||||||
# alias vim=nvim_ve
|
# alias vim=nvim_ve
|
||||||
alias ssh-hosts="grep -P \"^Host ([^*]+)$\" $HOME/.ssh/config | sed 's/Host //'"
|
alias s="ssh-menu"
|
||||||
|
|
||||||
# navigation
|
# navigation
|
||||||
alias cdgit="cd $GGROOT"
|
alias cdgit="cd $GGROOT"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
function nvim_ve {
|
function nvim_ve {
|
||||||
if [[ -e "$VIRTUAL_ENV" && -f "$VIRTUAL_ENV/bin/activate" ]]; then
|
if [[ -e $VIRTUAL_ENV && -f "$VIRTUAL_ENV/bin/activate" ]]; then
|
||||||
source "$VIRTUAL_ENV/bin/activate"
|
source "$VIRTUAL_ENV/bin/activate"
|
||||||
command nvim $@
|
command nvim $@
|
||||||
deactivate
|
deactivate
|
||||||
|
@ -35,11 +34,10 @@ function afm {
|
||||||
VER=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).version')
|
VER=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).version')
|
||||||
# OP=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).requirement?[0][0]')
|
# OP=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).requirement?[0][0]')
|
||||||
# echo "$2""$(echo "$OP" | tr -d '"')""$(echo "$VER" | tr -d '"')"
|
# echo "$2""$(echo "$OP" | tr -d '"')""$(echo "$VER" | tr -d '"')"
|
||||||
echo "$2""==""$(echo "$VER" | tr -d '"')"
|
echo "${2}==$(echo "$VER" | tr -d '"')"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function nukepip {
|
function nukepip {
|
||||||
pip uninstall $(pip freeze) -y
|
pip uninstall $(pip freeze) -y
|
||||||
pip install -r $(pyenv root)/default-packages
|
pip install -r $(pyenv root)/default-packages
|
||||||
|
@ -89,7 +87,6 @@ function dps {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function get_dump {
|
function get_dump {
|
||||||
if [[ -z $1 ]]; then
|
if [[ -z $1 ]]; then
|
||||||
echo "provide ssh host"
|
echo "provide ssh host"
|
||||||
|
@ -107,12 +104,13 @@ function get_dump {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ssh "$1" docker exec "$selected" pg_dump -U db --format=c db > "$2$(date +'%Y-%m-%dT%H.%M.%S%z')"
|
ssh "$1" docker exec "$selected" pg_dump -U db --format=c db >"$2$(date +'%Y-%m-%dT%H.%M.%S%z')"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ggcompile {
|
function ggcompile {
|
||||||
find -L $GGROOT -mindepth 1 -maxdepth 5 -type d -name .git -prune | xargs -n 1 dirname > "$GGROOT/compiled"
|
find -L "$GGROOT" -mindepth 1 -maxdepth 5 -type d -name .git -prune \
|
||||||
|
-exec dirname {} \; >"$GGROOT/compiled"
|
||||||
}
|
}
|
||||||
|
|
||||||
function tssh {
|
function tssh {
|
||||||
|
@ -123,3 +121,18 @@ function tssh {
|
||||||
|
|
||||||
ssh -t "$@" "command -v tmux && (tmux a || tmux new-session -s gorazd -c ~) || bash"
|
ssh -t "$@" "command -v tmux && (tmux a || tmux new-session -s gorazd -c ~) || bash"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ssh-menu {
|
||||||
|
selected=$(
|
||||||
|
grep 'Host .*' ~/.ssh/config \
|
||||||
|
| grep -v '*' \
|
||||||
|
| sed 's/Host \(.*\)/\1/' \
|
||||||
|
| fzf --cycle --bind 'tab:toggle-up,btab:toggle-down'
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ -z $selected ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
ssh "$selected"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue