Default connection on cmux
This commit is contained in:
parent
defed78fa6
commit
648c3312da
18
zsh/ssh
18
zsh/ssh
@ -22,7 +22,6 @@ function WRYN_REMOTE_CONNECTOR() {
|
||||
local CONNECTION="$2";
|
||||
|
||||
local SSH_ID="^$CONNECTION$WRYN_SSH_DELIMITER"
|
||||
local TMUX_UTF8_FLAG=$(locale charmap | grep -q 'UTF-8' && echo '-u')
|
||||
|
||||
[ $2 ] \
|
||||
|| { echo 'Must specify a connection'; return 1 };
|
||||
@ -35,9 +34,7 @@ function WRYN_REMOTE_CONNECTOR() {
|
||||
cp-to ) scp ${@:5} $(WRYN_SCP_PARSE_ARGS $SSH_ID $3):$4 ;;
|
||||
cp-from ) scp ${@:5} $(WRYN_SCP_PARSE_ARGS $SSH_ID):$3 $4 ;;
|
||||
copy-id ) ssh-copy-id ${@:3} $(WRYN_SSH_PARSE_ARGS $SSH_ID) ;;
|
||||
tmux ) [ $4 ] || [ $3 == 'a' ]\
|
||||
&& ssh $(WRYN_SSH_PARSE_ARGS $SSH_ID) -t tmux $TMUX_UTF8_FLAG ${@:3} \
|
||||
|| ssh $(WRYN_SSH_PARSE_ARGS $SSH_ID) -t tmux $TMUX_UTF8_FLAG a -t $3 ;;
|
||||
tmux ) WRYN_REMOTE_TMUX "$SSH_ID" ${@:3} ;;
|
||||
|
||||
* ) echo "$COMMAND not implemented" ;;
|
||||
esac
|
||||
@ -82,3 +79,16 @@ WRYN_SCP_PARSE_ARGS() {
|
||||
&& sed -n "s>$SSH_ID *-p \([^ ]*\)\(.*\)$>-P \1 $2\2>p" "$WRYN_SSH_CONNECTION_LIST"\
|
||||
|| sed -n "s/$SSH_ID *-p\(.*\)$/-P\1/p" "$WRYN_SSH_CONNECTION_LIST"
|
||||
}
|
||||
|
||||
WRYN_REMOTE_TMUX() {
|
||||
local SSH_ID="$1"
|
||||
local TMUX_UTF8_FLAG=$(locale charmap | grep -q 'UTF-8' && echo '-u')
|
||||
local DEFAULT_TMUX_SESSION_NAME='main'
|
||||
|
||||
[ ! $2 ] \
|
||||
&& ssh $(WRYN_SSH_PARSE_ARGS $SSH_ID) -t tmux new-session -A -s $DEFAULT_TMUX_SESSION_NAME;
|
||||
|
||||
[ $3 ] \
|
||||
&& ssh $(WRYN_SSH_PARSE_ARGS $SSH_ID) -t tmux $TMUX_UTF8_FLAG ${@:2} \
|
||||
|| ssh $(WRYN_SSH_PARSE_ARGS $SSH_ID) -t tmux $TMUX_UTF8_FLAG a -t $2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user