changelog shortlog graph tags branches changeset file revisions annotate raw help

Mercurial > demo / demo.lisp

revision 0: eb8ed24e8a76
child 3: 8f59e2f1b8c4
     1.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2+++ b/demo.lisp	Sun Apr 30 22:01:32 2023 -0400
     1.3@@ -0,0 +1,38 @@
     1.4+;; demo.lisp
     1.5+(in-package :cl-demo)
     1.6+
     1.7+(defparameter demo-path (merge-pathnames "cl-demo" (uiop:temporary-directory)))
     1.8+
     1.9+(defvar db-path (merge-pathnames "db" demo-path))
    1.10+
    1.11+(defun cli-opts ()
    1.12+  "Returns the top-level CLI options."
    1.13+  (list
    1.14+   (cli:make-option
    1.15+    :string
    1.16+    :description "demo app to run"
    1.17+    :short-name #\x
    1.18+    :long-name "app"
    1.19+    :initial-value "client"
    1.20+    :env-vars '("DEMO_APP")
    1.21+    :key :app)))
    1.22+
    1.23+(defun cli-handler (cmd)
    1.24+  "Handler for the `demo' command."
    1.25+  (let ((app (cli:getopt cmd :app)))
    1.26+    (format t "running app: ~A!~%" app)))
    1.27+
    1.28+(defun cli-cmd ()
    1.29+  "Our demo command."
    1.30+  (cli:make-command
    1.31+   :name "demo"
    1.32+   :description "A collection of demos"
    1.33+   :version "1.0.0"
    1.34+   :authors '("ellis <ellis@rwest.io>")
    1.35+   :license "WTFPL"
    1.36+   :options (demo/opts)
    1.37+   :handler #'demo/handler))
    1.38+
    1.39+(defun main ()
    1.40+  "A demo of some common-lisp functionality."
    1.41+  (cli:run (demo/cmd)))