2adae5be4089

ROC and more sketching
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Thu, 22 Nov 2018 00:46:02 -0500
parents c297e32bbfda
children 23baaf9d4f31
branches/tags (none)
files docs/02-usage.markdown docs/footer.markdown src/main.lisp

Changes

diff -r c297e32bbfda -r 2adae5be4089 docs/02-usage.markdown
--- a/docs/02-usage.markdown	Thu Nov 22 00:20:36 2018 -0500
+++ b/docs/02-usage.markdown	Thu Nov 22 00:46:02 2018 -0500
@@ -9,48 +9,57 @@
 Package
 -------
 
-All core Adopt functions are in the `adopt` package.  You can `:use` that if you
-really want to, but it's probably clearer to use namespaced `adopt:…` symbols.
+All core Adopt functions and macros are in the `adopt` package.  You can `:use`
+that if you really want to, but it's probably clearer to use namespaced
+`adopt:…` symbols.
+
+Interfaces
+----------
 
-Example
+define-interface and usage.  nothing else.
+
+Parsing
+-------
+
+`parse-options` with a bare-bones interface.
+
+Options
 -------
 
-    (define-interface *my-program* "[options] FILES"
-      (verbosity
-        "Output extra information."
-        :short #\v
-        :long "verbose"
-        :initial-value 0
-        :reduce (constantly 1))
-      (verbosity
-        "Shut up."
-        :short #\q
-        :long "quiet"
-        :reduce (constantly -1))
-      (ignore
-        "Ignore FILE.  May be specified multiple times."
-        :long "ignore"
-        :parameter "FILE"
-        :reduce #'append1)
-      (name
-        "Your name.  May be specified many times, last one wins."
-        :short #\n
-        :long "name"
-        :parameter "NAME"
-        :reduce #'latest)
-      (meows
-        "Meow."
-        :short #\m
-        :long "meow"
-        :initial-value 0
-        :reduce #'1+))
-    
-    (pprint
-      (multiple-value-list
-        (parse-options *my-program*
-                       '("-vqn" "steve"
-                         "--meow"
-                         "-m" "--meow" "foo"
-                         "--name=sjl" "more"
-                         "--" "--ignore" "bar"
-                         ))))
+talk about the option arguments.
+
+Short and Long Options
+----------------------
+
+short versus long arguments.  1+ is required.
+
+Initial Value
+-------------
+
+at this point it's just a default
+
+Reduce
+------
+
+talk about reducers. mention argparse's:
+
+`store_const` is `(constantly x)`
+
+`store` is `#'latest`
+
+`store_true` is `(constantly t)`
+
+`store_false` is `(constantly nil)`
+
+`append` is `append1`
+
+`append_const` is `(rcurry #'append1 x)`
+
+`count` is `1+` with an `initial-value` of `0`.
+
+need to figure out `help` and `version`.
+
+Usage Printing
+--------------
+
+It's `(print-usage interface)`.
diff -r c297e32bbfda -r 2adae5be4089 docs/footer.markdown
--- a/docs/footer.markdown	Thu Nov 22 00:20:36 2018 -0500
+++ b/docs/footer.markdown	Thu Nov 22 00:46:02 2018 -0500
@@ -1,6 +1,9 @@
-<i>Made with Lisp and love by [Steve Losh][] in Rochester, New York.</i>
+<i>Made with Lisp and love by [Steve Losh][].</i>
+
+<p><a href="http://rochestermade.com" title="Rochester Made"><img src="http://rochestermade.com/media/images/rochester-made-dark-on-light.png" alt="Rochester Made" title="Rochester Made" /></a></p>
 
 [Steve Losh]: http://stevelosh.com/
+[roc]: https://rochestermade.com/
 
 <script>
   (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
diff -r c297e32bbfda -r 2adae5be4089 src/main.lisp
--- a/src/main.lisp	Thu Nov 22 00:20:36 2018 -0500
+++ b/src/main.lisp	Thu Nov 22 00:46:02 2018 -0500
@@ -60,7 +60,7 @@
     :short short
     :parameter parameter
     :initial-value initial-value
-    :reduce reduce))
+    :reduce (or reduce (constantly t))))
 
 
 (defclass interface ()