Function: eshell/doas
eshell/doas is a byte-compiled function defined in em-tramp.el.gz.
Signature
(eshell/doas &rest ARGS)
Documentation
Call Tramp's doas method with ARGS.
Uses the system doas through Tramp's doas method.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/em-tramp.el.gz
(defun eshell/doas (&rest args)
"Call Tramp's doas method with ARGS.
Uses the system doas through Tramp's doas method."
(eshell-eval-using-options
"doas" args
'((?h "help" nil nil "show this usage screen")
(?u "user" t user "execute a command as another USER")
(?s "shell" nil shell "start a shell instead of executing COMMAND")
:show-usage
:parse-leading-options-only
:usage "[(-u | --user) USER] (-s | --shell) | COMMAND
Execute a COMMAND as the superuser or another USER.")
(let ((dir (eshell--method-wrap-directory default-directory "doas" user)))
(if shell
(throw 'eshell-replace-command
(eshell-parse-command "cd" (list dir)))
(throw 'eshell-external
(let ((default-directory dir))
(eshell-named-command (car args) (cdr args))))))))