diff options
author | Colin Okay <okay@toyful.space> | 2022-02-17 16:02:25 -0600 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2022-02-17 16:02:25 -0600 |
commit | ef3741726fcda3962e29110d49b4105a2ac40e50 (patch) | |
tree | bfa249b94bff7e8572bf6f5ea0bf95fb487f7565 | |
parent | 9844f6ae2512e7da6910e51c2d0d0f7da1550663 (diff) |
Beginning work on the CLON based CLI parsing
-rw-r--r-- | build-app.lisp | 12 | ||||
-rw-r--r-- | clpmfile | 6 | ||||
-rw-r--r-- | clpmfile.lock | 39 | ||||
-rw-r--r-- | oneliners.cli.asd | 4 | ||||
-rw-r--r-- | src/lib.lisp (renamed from src/main.lisp) | 80 |
5 files changed, 96 insertions, 45 deletions
diff --git a/build-app.lisp b/build-app.lisp new file mode 100644 index 0000000..c5a6f25 --- /dev/null +++ b/build-app.lisp @@ -0,0 +1,12 @@ +(asdf:load-system "oneliners.cli") + +(defpackage #:oneliners.cli.app + (:use #:cl #:net.didierverna.clon)) + +(in-package :oneliners.cli.app) + +(defsynopsis (:postfix "ARGS ...") + (text :contents "This is some arbitrary text.") + (group (:header "Group 1"))) + + @@ -2,6 +2,12 @@ (:api-version "0.4") (:source "quicklisp" :url "https://beta.quicklisp.org/dist/quicklisp.txt" :type :quicklisp) +(:source "ultralisp" :url "https://clpi.ultralisp.org/" :type :clpi) (:asd "oneliners.cli.asd") (:asd "oneliners.api-client.asd") + +(:system "net.didierverna.clon" :source "ultralisp") +(:system "net.didierverna.clon.core" :source "ultralisp") +(:system "net.didierverna.clon.termio" :source "ultralisp") + diff --git a/clpmfile.lock b/clpmfile.lock index 0521d30..53f4c43 100644 --- a/clpmfile.lock +++ b/clpmfile.lock @@ -13,6 +13,7 @@ (:implicit-file :type :file-system :system-files ("oneliners.cli.asd")) ("quicklisp" :url "https://beta.quicklisp.org/dist/quicklisp.txt" :type :quicklisp) +("ultralisp" :url "https://clpi.ultralisp.org/" :type :clpi) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -20,6 +21,9 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; :requirements +(:system :name "net.didierverna.clon.termio" :source "ultralisp") +(:system :name "net.didierverna.clon.core" :source "ultralisp") +(:system :name "net.didierverna.clon" :source "ultralisp") (:asd-file :name "oneliners.api-client.asd") (:asd-file :name "oneliners.cli.asd") @@ -39,16 +43,23 @@ ("chunga" :version "2020-04-27" :source "quicklisp" :systems ("chunga")) ("cl+ssl" :version "2021-12-30" :source "quicklisp" :systems ("cl+ssl")) ("cl-base64" :version "2020-10-16" :source "quicklisp" :systems ("cl-base64")) +("cl-clon" :version "2021-04-11" :source "quicklisp" :systems + ("net.didierverna.clon" "net.didierverna.clon.core" + "net.didierverna.clon.setup" "net.didierverna.clon.setup/termio")) ("cl-cookie" :version "2019-10-07" :source "quicklisp" :systems ("cl-cookie")) ("cl-ppcre" :version "2019-05-21" :source "quicklisp" :systems ("cl-ppcre")) ("cl-utilities" :version "2010-10-07" :source "quicklisp" :systems ("cl-utilities")) ("dexador" :version "2021-12-09" :source "quicklisp" :systems ("dexador")) +("didierverna/clon" :version "20210424171500" :source "ultralisp" :systems + ("net.didierverna.clon.termio")) ("fast-http" :version "2019-10-07" :source "quicklisp" :systems ("fast-http")) ("fast-io" :version "2020-09-25" :source "quicklisp" :systems ("fast-io")) ("flexi-streams" :version "2021-08-07" :source "quicklisp" :systems ("flexi-streams")) ("local-time" :version "2021-01-24" :source "quicklisp" :systems ("local-time")) +("named-readtables" :version "2021-12-09" :source "quicklisp" :systems + ("named-readtables")) ("oneliners.api-client.asd" :version :newest :source :implicit-file :systems ("oneliners.api-client")) ("oneliners.cli.asd" :version :newest :source :implicit-file :systems @@ -72,7 +83,6 @@ ("trivial-gray-streams")) ("trivial-mimes" :version "2020-07-15" :source "quicklisp" :systems ("trivial-mimes")) -("unix-opts" :version "2021-01-24" :source "quicklisp" :systems ("unix-opts")) ("usocket" :version "2019-12-27" :source "quicklisp" :systems ("usocket")) ("xsubseq" :version "2017-08-30" :source "quicklisp" :systems ("xsubseq")) @@ -110,6 +120,7 @@ ((:system :name "static-vectors") (:system :name "cffi-grovel")) ((:system :name "osicat") (:system :name "cffi")) ((:system :name "osicat") (:system :name "cffi-grovel")) + ((:system :name "net.didierverna.clon.termio") (:system :name "cffi")) ((:system :name "cl+ssl") (:system :name "cffi")) ((:system :name "cffi-toolchain") (:system :name "cffi")) ((:system :name "cffi-grovel") (:system :name "cffi")) @@ -123,6 +134,23 @@ ("cl-base64" ((:system :name "dexador") (:system :name "cl-base64"))) +("cl-clon" + ((:system :name "oneliners.cli") (:system :name "net.didierverna.clon")) + ((:system :name "net.didierverna.clon.termio") + (:system :name "net.didierverna.clon.core")) + ((:system :name "net.didierverna.clon.termio") + (:system :name "net.didierverna.clon.setup/termio")) + ((:system :name "net.didierverna.clon.setup/termio") + (:system :name "net.didierverna.clon.setup")) + ((:system :name "net.didierverna.clon.core") + (:system :name "net.didierverna.clon.setup")) + ((:system :name "net.didierverna.clon") + (:system :name "net.didierverna.clon.core")) + ((:system :name "net.didierverna.clon") + (:system :name "net.didierverna.clon.setup")) + (t (:system :name "net.didierverna.clon.core" :source "ultralisp")) + (t (:system :name "net.didierverna.clon" :source "ultralisp"))) + ("cl-cookie" ((:system :name "dexador") (:system :name "cl-cookie"))) ("cl-ppcre" ((:system :name "dexador") (:system :name "cl-ppcre")) @@ -134,6 +162,9 @@ ("dexador" ((:system :name "oneliners.cli") (:system :name "dexador")) ((:system :name "oneliners.api-client") (:system :name "dexador"))) +("didierverna/clon" + (t (:system :name "net.didierverna.clon.termio" :source "ultralisp"))) + ("fast-http" ((:system :name "dexador") (:system :name "fast-http"))) ("fast-io" ((:system :name "dexador") (:system :name "fast-io"))) @@ -144,6 +175,10 @@ ("local-time" ((:system :name "cl-cookie") (:system :name "local-time"))) +("named-readtables" + ((:system :name "net.didierverna.clon.setup") + (:system :name "named-readtables"))) + ("oneliners.api-client.asd" ((:system :name "oneliners.cli") (:system :name "oneliners.api-client")) (t (:asd-file :name "oneliners.api-client.asd"))) @@ -186,8 +221,6 @@ ("trivial-mimes" ((:system :name "dexador") (:system :name "trivial-mimes"))) -("unix-opts" ((:system :name "oneliners.cli") (:system :name "unix-opts"))) - ("usocket" ((:system :name "dexador") (:system :name "usocket")) ((:system :name "cl+ssl") (:system :name "usocket"))) diff --git a/oneliners.cli.asd b/oneliners.cli.asd index b072e32..10e8f39 100644 --- a/oneliners.cli.asd +++ b/oneliners.cli.asd @@ -5,11 +5,11 @@ :depends-on ("trivial-clipboard" "dexador" "osicat" - "unix-opts" + "net.didierverna.clon" "oneliners.api-client") :components ((:module "src" :components - ((:file "main")))) + ((:file "lib")))) :description "" :in-order-to ((test-op (test-op "oneliners.cli/tests")))) diff --git a/src/main.lisp b/src/lib.lisp index 0b33a6e..20f75ea 100644 --- a/src/main.lisp +++ b/src/lib.lisp @@ -7,31 +7,31 @@ ;;; CLI OPTIONS -(opts:define-opts - (:name :add - :description "Intaractively add a oneliner to the a wiki." - :long "add") - (:name :tags - :description "A comma separated list of tags to filter search results." - :short #\t - :long "tags" - :arg-parser #'identity - :meta-var "'T1, T2, ...'") - (:name :limit - :description "An integer. The maximum number of results to return." - :short #\l - :long "limit" - :meta-var "N" - :default 10 - :arg-parser #'parse-integer) - (:name :edit - :description "An integer, a result number. Interactively edit af command." - :long "edit" - :meta-var "RESULT" - :arg-parser #'parse-integer) - (:name :not-flagged - :description "Filter flagged oneliners from the search results" - :long "not-flagged")) +;; (opts:define-opts +;; (:name :add +;; :description "Intaractively add a oneliner to the a wiki." +;; :long "add") +;; (:name :tags +;; :description "A comma separated list of tags to filter search results." +;; :short #\t +;; :long "tags" +;; :arg-parser #'identity +;; :meta-var "'T1, T2, ...'") +;; (:name :limit +;; :description "An integer. The maximum number of results to return." +;; :short #\l +;; :long "limit" +;; :meta-var "N" +;; :default 10 +;; :arg-parser #'parse-integer) +;; (:name :edit +;; :description "An integer, a result number. Interactively edit af command." +;; :long "edit" +;; :meta-var "RESULT" +;; :arg-parser #'parse-integer) +;; (:name :not-flagged +;; :description "Filter flagged oneliners from the search results" +;; :long "not-flagged")) (defparameter +help-suffix+ "Unless RESULT is an integer, search for oneliners that involve each command in COMMANDS. @@ -45,11 +45,11 @@ E.g. # run the third result from the last search with arguments foo and bar ol 3 foo bar") -(defun help-text () - (opts:describe :prefix "Oneliners Wiki Command Line Tool" - :args "[[RESULT ARGS | COMMANDS]" - :usage-of "ol" - :suffix +help-suffix+)) +;; (defun help-text () +;; (opts:describe :prefix "Oneliners Wiki Command Line Tool" +;; :args "[[RESULT ARGS | COMMANDS]" +;; :usage-of "ol" +;; :suffix +help-suffix+)) ;;; CONFIG AND RESULTS FILE LOCATIONS @@ -105,13 +105,13 @@ printed to OUTPUT-STREAM. " ;;; main -(defun main () - (handler-case - (multiple-value-bind (options free-args) (opts:get-opts) - (print (list :options options :free-args free-args)) - (terpri) - (uiop:quit)) - (unix-opts:unknown-option (err) - (declare (ignore err)) - (princ (help-text)) - (terpri)))) +;; (defun main () +;; (handler-case +;; (multiple-value-bind (options free-args) (opts:get-opts) +;; (print (list :options options :free-args free-args)) +;; (terpri) +;; (uiop:quit)) +;; (unix-opts:unknown-option (err) +;; (declare (ignore err)) +;; (princ (help-text)) +;; (terpri)))) |