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 t="tmux a || tmux new-session -s $(whoami) -c ~"
|
||||
alias n=nvim_ve
|
||||
# alias vim=nvim_ve
|
||||
alias ssh-hosts="grep -P \"^Host ([^*]+)$\" $HOME/.ssh/config | sed 's/Host //'"
|
||||
alias s="ssh-menu"
|
||||
|
||||
# navigation
|
||||
alias cdgit="cd $GGROOT"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
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"
|
||||
command nvim $@
|
||||
deactivate
|
||||
|
@ -35,11 +34,10 @@ function afm {
|
|||
VER=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).version')
|
||||
# OP=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).requirement?[0][0]')
|
||||
# echo "$2""$(echo "$OP" | tr -d '"')""$(echo "$VER" | tr -d '"')"
|
||||
echo "$2""==""$(echo "$VER" | tr -d '"')"
|
||||
echo "${2}==$(echo "$VER" | tr -d '"')"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function nukepip {
|
||||
pip uninstall $(pip freeze) -y
|
||||
pip install -r $(pyenv root)/default-packages
|
||||
|
@ -89,7 +87,6 @@ function dps {
|
|||
fi
|
||||
}
|
||||
|
||||
|
||||
function get_dump {
|
||||
if [[ -z $1 ]]; then
|
||||
echo "provide ssh host"
|
||||
|
@ -107,12 +104,13 @@ function get_dump {
|
|||
return
|
||||
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 {
|
||||
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 {
|
||||
|
@ -123,3 +121,18 @@ function tssh {
|
|||
|
||||
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