aboutsummaryrefslogtreecommitdiff
path: root/app/draft.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'app/draft.lisp')
-rw-r--r--app/draft.lisp33
1 files changed, 13 insertions, 20 deletions
diff --git a/app/draft.lisp b/app/draft.lisp
index ea71e49..32698ca 100644
--- a/app/draft.lisp
+++ b/app/draft.lisp
@@ -3,6 +3,7 @@
(in-package :oneliners.cli.app)
(defun draft/new/handler (cmd)
+ (declare (ignore cmd))
(ol:add-new-oneliner))
(defun draft/new/command ()
@@ -12,10 +13,8 @@
:handler #'draft/new/handler))
-(defun draft/publish/handler (cmd)
- (a:if-let (name (first (cli:command-arguments cmd)))
- (ol::publish-draft name)
- (cli:print-usage-and-exit cmd t)))
+(defhandler draft/publish/handler (name)
+ (ol::publish-draft name))
(defun draft/publish/command ()
(cli:make-command
@@ -24,14 +23,12 @@
:description "publish draft to the server"
:handler #'draft/publish/handler))
-(defun draft/test/handler (cmd)
- (a:if-let (args (cli:command-arguments cmd))
- (ol:run-item (first args) (rest args)
- :verbose (cli:getopt cmd :verbose)
- :confirm (cli:getopt cmd :confirm)
- :timeout (cli:getopt cmd :timeout)
- :draftp t)
- (cli:print-usage-and-exit cmd t)))
+(defhandler draft/test/handler (name . args)
+ (ol:run-item name args
+ :verbose (cli:getopt *cmd* :verbose)
+ :confirm (cli:getopt *cmd* :confirm)
+ :timeout (cli:getopt *cmd* :timeout)
+ :draftp t))
(defun draft/test/command ()
(cli:make-command
@@ -41,10 +38,8 @@
:options (run/options)
:handler #'draft/new/handler))
-(defun draft/edit/handler (cmd)
- (a:if-let (name (first (cli:command-arguments cmd)))
- (ol:edit-item name t)
- (cli:print-usage-and-exit cmd t)))
+(defhandler draft/edit/handler (name)
+ (ol:edit-item name t))
(defun draft/edit/command ()
(cli:make-command
@@ -53,10 +48,8 @@
:description "interactively edits a draft"
:handler #'draft/edit/handler))
-(defun draft/trash/handler (cmd)
- (a:if-let (name (first (cli:command-arguments cmd)))
- (ol::drop-draft name)
- (cli:print-usage-and-exit cmd t)))
+(defhandler draft/trash/handler (name)
+ (ol::drop-draft name))
(defun draft/trash/command ()
(cli:make-command