From 2c49e526105cd04d4b76bc204929ee8b8a9f6c6b Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Fri, 18 Feb 2022 21:02:06 -0600 Subject: adding adding --- build-app.lisp | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'build-app.lisp') diff --git a/build-app.lisp b/build-app.lisp index c2f79ba..155f8e9 100644 --- a/build-app.lisp +++ b/build-app.lisp @@ -49,23 +49,24 @@ my1337pw.") (flag :long-name "help" :description "Print this help menu.") (enum :long-name "help-topic" - :enum '(:admin :wiki :invites) + :enum '(:contributor :adding :invites) :argument-name "TOPIC" - :description "Print help for a topic. Topics are: wiki, admin, invites")) - (group (:header "Wiki" :hidden t) - (text :contents "This section documents options used to add and edit oneliners in the wiki.") - (flag :long-name "add-interactive" - :description "Interactively add a new oneliner") - (flag :long-name "update-interactive" + :description "Print help for a topic. Topics are: adding, contributor, invites")) + (group (:header "Adding" :hidden t) + (flag :long-name "add" + :description "Intaractively add a oneliner and update the wiki.") + (flag :long-name "update" :description "Interactively edit a oneliner and update the wiki.")) - (group (:header "Admin" :hidden t) + (group (:header "Contributor" :hidden t) (flag :long-name "login" :description "Attempt to login to your contributor account. ARGS are interpreted as USERNAME PASSWORD. Success will return ab API token, writing it automatically into your config file.") + (flag :long-name "revoke" + :description "Revoke your own access token.")) + (group (:header "Invites" :hidden t) (flag :long-name "invite" :description "Request an invite token to send to a friend.") (flag :long-name "redeem" - :description "Redeem an invite token. See also --help-topic=invites")) - (group (:header "Invites" :hidden t) + :description "Redeem an invite token.") (text :contents +invite-help-text+))) @@ -96,19 +97,28 @@ than the users." (handler-case (let ((arguments (remainder))) (cond + ((getopt :long-name "redeem") (destructuring-bind (token name pass) arguments (cli::redeem-invite token name pass))) + ((getopt :long-name "login") (destructuring-bind (user pass) arguments (cli::login user pass))) + ((getopt :long-name "invite") (cli::request-invite-code)) + + ((getopt :long-name "add") + (cli::add-new)) + (arguments ;; when the first argument is a number, try run a oneliner (a:when-let (hist-number (parse-integer (first arguments) :junk-allowed t)) - (format t "TBD: Going to run command ~a with arguments ~a~%" - hist-number (rest arguments)) + (if (getopt :long-name "flag") + (format t "TBD: going to flag a command~%") ;(cli::flag-item hist-number) + (format t "TBD: Going to run command ~a with arguments ~a~%" + hist-number (rest arguments))) (uiop:quit)) ;; otherwise search for oneliners (cli::search-for-oneliners arguments -- cgit v1.2.3