summaryrefslogtreecommitdiffhomepage
path: root/lib/eos
diff options
context:
space:
mode:
Diffstat (limited to 'lib/eos')
-rw-r--r--lib/eos/jao-shell.el33
1 files changed, 28 insertions, 5 deletions
diff --git a/lib/eos/jao-shell.el b/lib/eos/jao-shell.el
index f3ce438..ff1c160 100644
--- a/lib/eos/jao-shell.el
+++ b/lib/eos/jao-shell.el
@@ -24,14 +24,37 @@
;;; Code:
+(defun jao-shell--quote (x) (shell-quote-argument (format "%s" x)))
+
+;;;###autoload
(defun jao-shell-cmd-lines (cmd &rest args)
- (let ((cmd (concat cmd " "
- (mapconcat #'shell-quote-argument args " "))))
+ (let ((cmd (concat cmd " " (mapconcat #'jao-shell--quote args " "))))
(split-string (shell-command-to-string cmd) "\n" t)))
-
-(defun jao-shell-cmd-line (cmd &rest args)
- (car (apply #'jao-shell-cmd-lines cmd args)))
+;;;###autoload
+(defun jao-shell-string (cmd &rest args)
+ (string-trim (or (car (apply #'jao-shell-cmd-lines cmd args)) "")))
+
+;;;###autoload
+(defun jao-shell-exec (command)
+ (interactive
+ (list (read-shell-command "$ "
+ (if current-prefix-arg
+ (cons (concat " " (buffer-file-name)) 0)
+ ""))))
+ (start-process-shell-command command nil command))
+
+(defmacro jao-shell-def-exec (name &rest args)
+ `(defun ,name (&rest other-args)
+ (interactive)
+ (start-process-shell-command
+ ,(car args)
+ "*jao-exec - console*"
+ (string-join (append (list ,@args) other-args) " "))))
+
+;;;###autoload
+(defun jao-shell-running-p (pr)
+ (not (string-blank-p (shell-command-to-string (concat "pidof " pr)))))
(provide 'jao-shell)
;;; jao-shell.el ends here