changelog shortlog graph tags branches changeset file revisions annotate raw help

Mercurial > demo / demo.lisp

revision 22: ba323d8c0f93
parent 21: 1059e7b52e47
child 23: dc7e11694976
     1.1--- a/demo.lisp	Sat Jun 03 19:57:46 2023 -0400
     1.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3@@ -1,45 +0,0 @@
     1.4-;; demo.lisp
     1.5-(in-package :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-   (cli:make-option
    1.23-    :string
    1.24-    :description "path to config"
    1.25-    :short-name #\c
    1.26-    :long-name "config"
    1.27-    :initial-value "$DEMO_PATH/.fig"
    1.28-    :env-vars '("DEMO_CONFIG"))))
    1.29-
    1.30-(defun cli-handler (cmd)
    1.31-  "Handler for the `demo' command."
    1.32-  (let ((app (cli:getopt cmd :app)))
    1.33-    (format t "running: ~A!~%" app)))
    1.34-
    1.35-(defun cli-cmd ()
    1.36-  "Our demo command."
    1.37-  (cli:make-command
    1.38-   :name "demo"
    1.39-   :description "A collection of demos"
    1.40-   :version "1.0.0"
    1.41-   :authors '("ellis <ellis@rwest.io>")
    1.42-   :license "WTFPL"
    1.43-   :options (cli-opts)
    1.44-   :handler #'cli-handler))
    1.45-
    1.46-(defun main ()
    1.47-  "A demo of some common-lisp functionality."
    1.48-  (cli:run (cli-cmd)))