diff options
-rw-r--r-- | app/account.lisp | 93 | ||||
-rw-r--r-- | app/app.lisp | 17 | ||||
-rw-r--r-- | app/app.orig.lisp | 2 | ||||
-rw-r--r-- | oneliners.cli.asd | 8 |
4 files changed, 104 insertions, 16 deletions
diff --git a/app/account.lisp b/app/account.lisp new file mode 100644 index 0000000..7d4b749 --- /dev/null +++ b/app/account.lisp @@ -0,0 +1,93 @@ +;;;; account.lisp + +(in-package :oneliners.cli.app ) + + +(defhandler account/login/handler (username password) + (ol:login username password)) + +(defun account/login/command () + (cli:make-command + :name "login" + :usage "<USERNAME> <PASSWORD>" + :description "obtains an API access key and stores it locally" + :handler #'account/login/command)) + +(defun account/logout/handler (cmd) + (declare (ignore cmd)) + (ol:revoke-access)) + +(defun account/logout/command () + (cli:make-command + :name "logout" + :description "revokes access for the currently stored key" + :handler #'account/logout/command)) + +(defun account/signature/handler (cmd) + (declare (ignore cmd)) + (ol:change-signature)) + +(defun account/signature/command () + (cli:make-command + :name "signature" + :description "a signature is text users seen when they do `ol account whois <you>`" + :handler #'account/signature/handler)) + +(defhandler account/password/handler (old new) + (ol:change-pw old new new)) + +(defun account/password/command () + (cli:make-command + :name "password" + :usage "<OLDPW> <NEWPW>" + :description "change your password" + :handler #'account/password/handler)) + +(defhandler account/whois/handler (nick) + (ol:show-contributor nick)) + +(defun account/whois/command () + (cli:make-command + :name "whois" + :description "View the user's signature, if they have one." + :handler #'account/whois/command)) + +(defun account/invite/handler (cmd) + (declare (ignore cmd)) + (ol:request-invite-code)) + +(defun account/invite/command () + (cli:make-command + :name "invite" + :description "request an invite token from the server" + :handler #'account/invite/handler)) + +(defhandler account/redeem/handler (token name password) + (ol:redeem-invite token name password)) + +(defun account/redeem/command () + (cli:make-command + :name "redeem" + :usage "<TOKEN> <NEW-USERNAME> <NEW-PASSWORD>" + :handler #'account/redeem/handler + :description "redeem an invite token to create a new contributor account")) + +(defun account/subcommands () + (list + (account/login/command) + (account/logout/command) + (account/signature/command) + (account/password/command) + (account/whois/command) + (account/invite/command) + (account/redeem/command))) + +(defun account/handler (cmd) + (cli:print-usage-and-exit cmd t)) + +(defun account/command () + (cli:make-command + :name "account" + :description "commands having to do with user accounts" + :handler #'account/handler + :sub-commands (account/subcommands))) diff --git a/app/app.lisp b/app/app.lisp index 46ef74b..0ed0b45 100644 --- a/app/app.lisp +++ b/app/app.lisp @@ -33,21 +33,8 @@ (clip/command) (show/command) (draft/command) - (modify/command))) - - -;; ol account login <USER> <PW> -;; ol account logout -;; ol account signature <new sig> -;; ol account password <new pw> <repeat> -;; ol account whois <user> -;; ol invite new -;; ol invite redeem - -;; ol account use <SERVER> ;; for switchign servers - -;; new edit delete publish trash drafts flag unflag lockated unlock -;; redeem login logout password signature whois + (modify/command) + (account/command))) (defun toplevel/handler (cmd) "Prints usage statement and then exits" diff --git a/app/app.orig.lisp b/app/app.orig.lisp index e83bd66..1015d1e 100644 --- a/app/app.orig.lisp +++ b/app/app.orig.lisp @@ -103,7 +103,7 @@ Their meaning is as follows: collect (apply 'format nil row-format group))))) (defsynopsis (:postfix "COMMAND [ARGS...]") - (group (:header "SEARCHING FOR ONELINERS" :hidden t) + (group (:header "SEARCHING FOR ONELINERS" :hidden t) (text :contents "Usage: ol [OPTIONS] search [TERMS...]") (text :contents " ") (text :contents "Search for oneliners that have been tagged with all of TERMS.") diff --git a/oneliners.cli.asd b/oneliners.cli.asd index f1fb01b..97b3036 100644 --- a/oneliners.cli.asd +++ b/oneliners.cli.asd @@ -35,6 +35,14 @@ :components ((:module "app" :components ((:file "package") + (:file "util") + (:file "search") + (:file "run") + (:file "clip") + (:file "draft") + (:file "show") + (:file "modify") + (:file "account") (:file "app")))) :description "A Command-Line tool for fetching, running, creating, and updating unix oneliners from a oneliners wiki server of your |