aboutsummaryrefslogtreecommitdiff
path: root/build-app.lisp
blob: 24064e7bd5ca2dac9157b1840895a529720399c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(asdf:load-system "oneliners.cli")

(defpackage #:oneliners.cli.app
  (:use #:cl #:net.didierverna.clon))

(in-package :oneliners.cli.app)

(defsynopsis (:postfix "TERMS ... | N ARGS ...")
  (text :contents "This is some arbitrary text.")
  (group (:header "Search")
         (lispobj :long-name "count" :short-name "n"
                  :argument-type :optional
                  :default-value 10
                  :typespec 'integer)
         (flag :long-name "not-flagged"
               :description "Request that no flagged oneliners are returned."))
  (group (:header "Admin" :hidden t)
         (flag :long-name "invite"
               :description "Request an invite token to send to a friend.")
         (stropt :long-name "redeem"
                 :argument-type :optional
                 :default-value ""
                 :argument-name "TOKEN"
                 :description "Redeem an invite token. Enter an
                 interactive process of setting up a new contributor
                 account with the inviting server"))
  (group ()
         (enum :long-name "help" :short-name "h"
               :enum '(:help :admin)
               :description "print this help menu.")))




(defun main ()
  "Entry point for our standalone application."
  (make-context)
  (when (getopt :short-name "h")
    (help )
    (uiop:quit))
  (let ((arguments (remainder)))

    (unless arguments
      (help)
      (uiop:quit))

    (alexandria: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))
      (uiop:quit))

    (format t "TBD: Going to search for commands mentioning the terms ~a~%" arguments))

  (uiop:quit))


(dump "ol" main)