changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/bin/packy.lisp

changeset 651: af486e0a40c9
parent: 692dfd7f02d0
child: 2e7d93b892a5
author: Richard Westhaver <ellis@rwest.io>
date: Sat, 14 Sep 2024 22:13:06 -0400
permissions: -rw-r--r--
description: multi-binaries, working on removing x.lisp
1 (defpackage :bin/packy
2  (:use :cl :std :sb-ext :cli :packy :clap :log))
3 
4 (in-package :bin/packy)
5 
6 ;;; CLI
7 (defvar *pk-targets* nil)
8 (defopt pk-help (print-help *cli*))
9 (defopt pk-version (print-version *cli*))
10 (defopt pk-log-level (when *arg* (setq *log-level* :debug)))
11 (defopt pk-target (setq *pk-targets* *arg*))
12 (defcmd pk-show (print (list *optc* *argc* *opts* *args* *pk-targets*)))
13 
14 (define-cli *packy-cli*
15  :name "packy"
16  :version "0.1.0"
17  :description "Universal Package Manager"
18  :thunk 'pk-show
19  :opts ((:name "level" :global t :description "set the log level" :thunk pk-log-level)
20  (:name "help" :global t :description "print help" :thunk pk-help)
21  (:name "version" :global t :description "print version" :thunk pk-version))
22  :cmds ((:name show
23  :opts (:name "target" :thunk pk-target)
24  :thunk pk-show)))
25 
26 (defun run ()
27  (let ((*log-level* :info))
28  (with-cli (*packy-cli* opts cmds args) (cli:args)
29  (do-cmd *cli*)
30  (debug-opts *cli*))))
31 
32 (defmain start-packy ()
33  (let ((*print-readably* t))
34  (run)
35  (sb-ext:exit :code 0)))