aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-02-22 11:39:42 -0600
committerColin Okay <okay@toyful.space>2022-02-22 11:39:42 -0600
commitd6dee4eb2906b1a845488065066fae7ef6906338 (patch)
tree2782ee0f642b0f8e15ebf74633f84d2849201718
parente18e4e43d0467b2341c2176dcdb467f12d4358c7 (diff)
supporting forced clipping. defaulting to bash
-rw-r--r--build-app.lisp2
-rw-r--r--oneliners.api-client.lisp18
-rw-r--r--src/lib.lisp8
3 files changed, 14 insertions, 14 deletions
diff --git a/build-app.lisp b/build-app.lisp
index 8be3639..b0405f5 100644
--- a/build-app.lisp
+++ b/build-app.lisp
@@ -135,7 +135,7 @@ than the users."
((getopt :long-name "unlock")
(cli::unlock-item hist-number))
(t
- (cli::run-item hist-number (rest arguments))))
+ (cli::run-item hist-number (rest arguments) (getopt :long-name "clip"))))
(uiop:quit))
;; otherwise search for oneliners
(cli::search-for-oneliners arguments
diff --git a/oneliners.api-client.lisp b/oneliners.api-client.lisp
index b011457..5fcaa92 100644
--- a/oneliners.api-client.lisp
+++ b/oneliners.api-client.lisp
@@ -5,15 +5,15 @@
(defpackage #:ONELINERS.API-CLIENT
(:use :cl :lazybones-client.shared)
(:export #:*host* #:*body* #:*headers* #:*cookies* #:request-with
- #:GET--ONELINERS
-#:PUT--ONELINER-ENTRY-FLAG
-#:PATCH--ONELINER-ENTRY-EDIT
-#:PUT--ONELINER-ONELINER-LOCKED
-#:POST--ONELINER
-#:POST--INVITE
-#:DELETE--ACCESS-ACCESS
-#:POST--ACCESS
-#:POST--INVITE-REDEEM-CODE))
+ #:GET--ONELINERS
+ #:PUT--ONELINER-ENTRY-FLAG
+ #:PATCH--ONELINER-ENTRY-EDIT
+ #:PUT--ONELINER-ONELINER-LOCKED
+ #:POST--ONELINER
+ #:POST--INVITE
+ #:DELETE--ACCESS-ACCESS
+ #:POST--ACCESS
+ #:POST--INVITE-REDEEM-CODE))
(in-package :ONELINERS.API-CLIENT)
diff --git a/src/lib.lisp b/src/lib.lisp
index 442e023..0ea4cda 100644
--- a/src/lib.lisp
+++ b/src/lib.lisp
@@ -152,8 +152,8 @@ the directories that appear in the value of that variable."
(ppcre:all-matches-as-strings "\\$[a-zA-Z_][a-zA-Z0-9_]*" oneliner)
:test #'equal))
-(defun handle-run-oneliner (ol &key (runstyle "auto"))
- (if (equalp runstyle "manual")
+(defun handle-run-oneliner (ol &optional clip)
+ (if clip
(progn (trivial-clipboard:text ol)
(format t "Copied oneliner to clipboard~%"))
(progn
@@ -163,7 +163,7 @@ the directories that appear in the value of that variable."
(run-with-shell ol :shell-name (or (get-shell) "bash")))))
-(defun run-item (item-number args)
+(defun run-item (item-number args &optional force-clip)
(with-cached-result (ol item-number)
(let* ((oneliner (getf ol :oneliner))
(runstyle (getf ol :runstyle))
@@ -186,7 +186,7 @@ the directories that appear in the value of that variable."
do (setf oneliner
(str:replace-all var (second bound) oneliner)))
- (handle-run-oneliner oneliner :runstyle runstyle)))))
+ (handle-run-oneliner oneliner (or force-clip (equalp runstyle "manual")))))))
(defun add-new-oneliner ()