summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-10-27 09:44:45 -0400
committerJune McEnroe <june@causal.agency>2020-10-27 09:44:45 -0400
commitca6c6e2d16d93c23f8760bf4b662480478a6951b (patch)
tree281b6cbfecf6864a776bb069c7ccaf3f675212e4
parentUse mandoc -T utf8 for text. (diff)
downloadsrc-ca6c6e2d16d93c23f8760bf4b662480478a6951b.tar.gz
src-ca6c6e2d16d93c23f8760bf4b662480478a6951b.zip
Allow cd host:path over ssh
Requires AcceptEnv SSH_CD in the remote sshd_config.
Diffstat (limited to '')
-rw-r--r--home/.shrc6
1 files changed, 6 insertions, 0 deletions
diff --git a/home/.shrc b/home/.shrc
index feb679ef..df1c8b26 100644
--- a/home/.shrc
+++ b/home/.shrc
@@ -20,12 +20,18 @@ type doas >/dev/null 2>&1 && alias sudo=doas
 cd() {
 	if [ $# -eq 0 ]; then
 		builtin cd
+	elif [ "${1%%:*}" != "$1" ]; then
+		ssh -o "SetEnv SSH_CD=${1#*:}" "${1%%:*}"
 	elif [ -e "$1" -a ! -d "$1" ]; then
 		builtin cd "${1%/*}" && $EDITOR "${1##*/}"
 	else
 		builtin cd "$@"
 	fi
 }
+if [ -n "${SSH_CD:-}" ]; then
+	cd "${SSH_CD}"
+	unset SSH_CD
+fi
 
 PS0=$'\n'
 PS1='\$ '
04-07ui-blob: don't segfault when no path is givenJohn Keeping 2013-03-20Convert pager navigation into a unordered listLukas Fleischer 2013-03-20Makefile: remove CGIT-CFLAGS files in clean stageJason A. Donenfeld 2013-03-20ui-summary.c: Move urls variable into print_urls()Lukas Fleischer 2013-03-20Fix colspan valuesLukas Fleischer 2013-03-20html: check return value of writeJason A. Donenfeld 2013-03-20ui-shared: squelch compiler warning.Jason A. Donenfeld 2013-03-20cgit.mk: Use SHELL_PATH_SQ to run gen-version.shJohn Keeping 2013-03-20cgit.mk: don't rebuild everything if CGIT_VERSION changesJohn Keeping 2013-03-20ui-patch: use cgit_version not CGIT_VERSIONJohn Keeping 2013-03-20Makefile: re-use Git's Makefile where possibleJohn Keeping