aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-02-28 16:10:16 -0600
committerColin Okay <okay@toyful.space>2022-02-28 16:10:16 -0600
commit260d0cfae03e75c298fd4b349ff496f35bd76143 (patch)
treebe9c496aaed5818bdc4cdccbeb3df7248fdba51a
parente128fcb2a021587aa428097f867c200c1ed3c426 (diff)
whois command.
-rw-r--r--build-app.lisp6
-rw-r--r--src/lib.lisp13
2 files changed, 19 insertions, 0 deletions
diff --git a/build-app.lisp b/build-app.lisp
index 0899c33..72e5f5b 100644
--- a/build-app.lisp
+++ b/build-app.lisp
@@ -61,6 +61,8 @@ my1337pw.")
(group (:header "HELP OPTIONS")
(flag :long-name "explain"
:description "View oneliner explaination text.")
+ (flag :long-name "whois"
+ :description "View information about a contributor. ARGS is just a contributor handle.")
(enum :long-name "help"
:enum '(:account :wiki :invites)
:argument-name "TOPIC"
@@ -122,6 +124,10 @@ than the users."
(handler-case
(let ((arguments (remainder)))
(cond
+ ((getopt :long-name "whois")
+ (assert (first arguments))
+ (cli::show-contributor (first arguments)))
+
((getopt :long-name "redeem")
(destructuring-bind (token name pass) arguments
(cli::redeem-invite token name pass)))
diff --git a/src/lib.lisp b/src/lib.lisp
index c90a022..93a19aa 100644
--- a/src/lib.lisp
+++ b/src/lib.lisp
@@ -416,6 +416,19 @@ the directories that appear in the value of that variable."
(api:put--contributor-who-signature (contributor-handle) :token (api-token))
(format t "Your signature was changed.~%"))))
+(defun print-contributor (contributor)
+ (format t "~20a ~@[-- ~a~]~%"
+ (getf contributor :handle)
+ (getf contributor :signature)))
+
+(defun show-contributor (name)
+ (ensure-config)
+ (api:request-with
+ (:host (host))
+ (a:when-let (contributor
+ (api:get--contributor-who name))
+ (print-contributor (jonathan:parse contributor)))))
+
(defun redeem-invite (token name pass)
(ensure-config )
(when (yes-or-no-p +agree-to-the-unlicense+)