summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Pykhalov <go.wigust@gmail.com>2019-05-13 02:23:09 +0300
committerOleg Pykhalov <go.wigust@gmail.com>2019-05-13 02:29:40 +0300
commitc4792c8486b190a812ed2ef8492922d185282f54 (patch)
tree44fa302b72a245559b7221ab31c26db0223112e9
parentterminal-here: Implement directory specification. (diff)
downloademacs-terminal-here-c4792c8486b190a812ed2ef8492922d185282f54.tar.gz
terminal-here.el: Implement ssh sudo.
* terminal-here.el (terminal-here-launch): Implement ssh sudo.
-rw-r--r--terminal-here.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/terminal-here.el b/terminal-here.el
index e504a54..15c924d 100644
--- a/terminal-here.el
+++ b/terminal-here.el
@@ -18,6 +18,7 @@
;;; Code:
(require 'cl-lib)
+(require 's)
;; TODO: it would be nice not to need to load all of tramp just for the file
;; name parsing. I'm not sure if that's possible though.
@@ -237,7 +238,19 @@ changed it by running `cd'."
(list (if current-prefix-arg (read-directory-name "Directory: ")
default-directory)))
(when multiplexer (terminal-here-not-null-symbol terminal-here-multiplexer))
- (terminal-here-launch-in-directory directory multiplexer))
+ (if (and (string-prefix-p "/ssh:" directory)
+ (s-contains? "|" directory))
+ (let ((ssh+sudo (split-string directory "|")))
+ (terminal-here-launch-in-directory
+ (mapconcat 'identity (list "/ssh:"
+ (cadr (split-string (car ssh+sudo) ":"))
+ ":/home/sup")
+ "")
+ multiplexer)
+ (start-process "xdotool" nil (expand-file-name "~/bin/sudo-to-user-web")
+ (car (split-string (nth 1 (split-string (cadr ssh+sudo) ":"))
+ "@"))))
+ (terminal-here-launch-in-directory directory multiplexer)))
;;;###autoload
(defalias 'terminal-here 'terminal-here-launch)