changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > demo / demo.lisp

changeset 14: 2bbf5ce73537
parent: d8f806f1d327
author: ellis <ellis@rwest.io>
date: Tue, 23 May 2023 20:43:02 -0400
permissions: -rw-r--r--
description: rs updates
1 ;; demo.lisp
2 (in-package :demo)
3 
4 (defparameter demo-path (merge-pathnames "cl-demo" (uiop:temporary-directory)))
5 
6 (defvar db-path (merge-pathnames "db" demo-path))
7 
8 (defun cli-opts ()
9  "Returns the top-level CLI options."
10  (list
11  (cli:make-option
12  :string
13  :description "demo app to run"
14  :short-name #\x
15  :long-name "app"
16  :initial-value "client"
17  :env-vars '("DEMO_APP")
18  :key :app)
19  (cli:make-option
20  :string
21  :description "path to config"
22  :short-name #\c
23  :long-name "config"
24  :initial-value "$DEMO_PATH/.fig"
25  :env-vars '("DEMO_CONFIG"))))
26 
27 (defun cli-handler (cmd)
28  "Handler for the `demo' command."
29  (let ((app (cli:getopt cmd :app)))
30  (format t "running: ~A!~%" app)))
31 
32 (defun cli-cmd ()
33  "Our demo command."
34  (cli:make-command
35  :name "demo"
36  :description "A collection of demos"
37  :version "1.0.0"
38  :authors '("ellis <ellis@rwest.io>")
39  :license "WTFPL"
40  :options (cli-opts)
41  :handler #'cli-handler))
42 
43 (defun main ()
44  "A demo of some common-lisp functionality."
45  (cli:run (cli-cmd)))