diff options
author | Colin Okay <okay@toyful.space> | 2022-03-14 19:36:18 -0500 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2022-03-14 19:36:18 -0500 |
commit | 130ae266f51f63ac423a65b17749a4d38dda1018 (patch) | |
tree | 495e848885014b8854f0408f8118daa05ec00bf8 /lib | |
parent | 67c793633bfcd46997155341dd4b1776fb6a6728 (diff) |
Added a --verbose / -v option to RUN
Diffstat (limited to 'lib')
-rw-r--r-- | lib/client.lisp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/client.lisp b/lib/client.lisp index 39d60ec..9f34bb5 100644 --- a/lib/client.lisp +++ b/lib/client.lisp @@ -92,14 +92,14 @@ running the body. If such a oneliner can be found." (defvar *ol-output-timeout* 1) -(defun run-item (ident args &key force-clip (timeout nil timeout-p) draftp) +(defun run-item (ident args &key force-clip (timeout nil timeout-p) draftp verbose) "Runs a oneliner identified by IDENT (if available) with arguments ARGS." (let ((ol (if draftp (fetch-draft ident) (the-oneliner ident)))) (when ol (let ((*ol-output-timeout* (if timeout-p timeout *ol-output-timeout*))) - (bind-vars-and-run-oneliner ol args force-clip))))) + (bind-vars-and-run-oneliner ol args force-clip verbose))))) -(defun bind-vars-and-run-oneliner (ol args &optional force-clip) +(defun bind-vars-and-run-oneliner (ol args &optional force-clip verbose) (let* ((oneliner (oneliner-oneliner ol)) (runstyle (oneliner-runstyle ol)) (pos-args (get-positional-arguments ol)) @@ -120,17 +120,18 @@ running the body. If such a oneliner can be found." do (setf oneliner (str:replace-all var (second bound) oneliner))) - (handle-run-oneliner oneliner (or force-clip (equalp runstyle "manual")))))) + (handle-run-oneliner oneliner (or force-clip (equalp runstyle "manual")) verbose)))) -(defun handle-run-oneliner (ol &optional clip) +(defun handle-run-oneliner (ol &optional clip (verbose t)) (if clip (progn (trivial-clipboard:text ol) (format t "Copied oneliner to clipboard~%")) (progn - (format t "Attempting to run:~%") - (princ ol) - (princ #\newline) - (princ #\newline) + (when verbose + (format t "Attempting to run:~%") + (princ ol) + (princ #\newline) + (princ #\newline)) (run-with-shell ol :shell-name (or (shell) "bash") :await-output-p *ol-output-timeout*)))) ;;; ADDING ONELINERS |