changelog shortlog graph tags branches changeset files file revisions raw help

Mercurial > core / annotate lisp/lib/cli/clap/pkg.lisp

changeset 688: 517c65b51e6b
parent: 39170f311b8c
author: Richard Westhaver <ellis@rwest.io>
date: Tue, 01 Oct 2024 21:52:17 -0400
permissions: -rw-r--r--
description: clap tests
419
0f0e5f9b5c55 add emacs/babel.org, finished clap refactor phase 1, test system fixes and more top-level packages
Richard Westhaver <ellis@rwest.io>
parents: 404
diff changeset
1
 ;;; cli/clap/pkg.lisp --- Clap Package Definitions
0f0e5f9b5c55 add emacs/babel.org, finished clap refactor phase 1, test system fixes and more top-level packages
Richard Westhaver <ellis@rwest.io>
parents: 404
diff changeset
2
 
0f0e5f9b5c55 add emacs/babel.org, finished clap refactor phase 1, test system fixes and more top-level packages
Richard Westhaver <ellis@rwest.io>
parents: 404
diff changeset
3
 ;; 
0f0e5f9b5c55 add emacs/babel.org, finished clap refactor phase 1, test system fixes and more top-level packages
Richard Westhaver <ellis@rwest.io>
parents: 404
diff changeset
4
 
0f0e5f9b5c55 add emacs/babel.org, finished clap refactor phase 1, test system fixes and more top-level packages
Richard Westhaver <ellis@rwest.io>
parents: 404
diff changeset
5
 ;;; Code:
426
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
6
 (defpackage :cli/clap/vars
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
7
   (:use :cl)
560
b9c64be96888 make cli/clap more dynamic
Richard Westhaver <ellis@rwest.io>
parents: 532
diff changeset
8
   (:export :*cli-group-separator* :*no-exit* :*default-cli-def*
b9c64be96888 make cli/clap more dynamic
Richard Westhaver <ellis@rwest.io>
parents: 532
diff changeset
9
    :*default-cli-class* :*cli-opt-kinds* :*cli* :*opts*
561
42bc1432f217 bin updates
Richard Westhaver <ellis@rwest.io>
parents: 560
diff changeset
10
    :*args* :*argc* :*arg* :*optc*))
426
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
11
 
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
12
 (defpackage :cli/clap/util
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
13
   (:use :cl :std :log :sb-ext :cli/clap/vars)
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
14
   (:export :args :arg0 :long-opt-p
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
15
    :short-opt-p :opt-group-p :opt-string-prefix-eq :cli-opt-kind-p
643
f901de70a80e opt fixes and test updates
Richard Westhaver <ellis@rwest.io>
parents: 625
diff changeset
16
    :default-thunk
653
119532882cb1 added keyword-opts (experimental)
Richard Westhaver <ellis@rwest.io>
parents: 649
diff changeset
17
    :long-opt-has-eq-p
119532882cb1 added keyword-opts (experimental)
Richard Westhaver <ellis@rwest.io>
parents: 649
diff changeset
18
    :opt-keyword-p))
426
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
19
 
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
20
 (defpackage :cli/clap/macs
561
42bc1432f217 bin updates
Richard Westhaver <ellis@rwest.io>
parents: 560
diff changeset
21
   (:use :cl :std :log :sb-ext :cli/clap/util :cli/clap/vars)
567
32995daa9a07 skel and cli updates
Richard Westhaver <ellis@rwest.io>
parents: 561
diff changeset
22
   (:export :defopt :defcmd
645
3e6a17fb5712 clap upgrades
Richard Westhaver <ellis@rwest.io>
parents: 643
diff changeset
23
    :make-opt-parser :with-cli-handlers :make-shorty
3e6a17fb5712 clap upgrades
Richard Westhaver <ellis@rwest.io>
parents: 643
diff changeset
24
    :with-opt-restart-case))
426
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
25
 
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
26
 (defpackage :cli/clap/proto
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
27
   (:use :cl :std :log :sb-ext)
688
517c65b51e6b clap tests
Richard Westhaver <ellis@rwest.io>
parents: 661
diff changeset
28
   (:import-from :cli/clap/util :args)
426
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
29
   (:export :proc-args :clap-error :find-short-opts
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
30
    :find-cmd :find-opts :parse-args :print-help
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
31
    :print-usage :print-version :do-cmds :do-cmd
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
32
    :active-cmds :active-opts :call-opt :do-opt
625
e49442cd6010 cli tweaks
Richard Westhaver <ellis@rwest.io>
parents: 623
diff changeset
33
    :push-cmd :push-opt :cli-equal
645
3e6a17fb5712 clap upgrades
Richard Westhaver <ellis@rwest.io>
parents: 643
diff changeset
34
    :do-opts
3e6a17fb5712 clap upgrades
Richard Westhaver <ellis@rwest.io>
parents: 643
diff changeset
35
    :clap-simple-error
3e6a17fb5712 clap upgrades
Richard Westhaver <ellis@rwest.io>
parents: 643
diff changeset
36
    :clap-simple-warning
3e6a17fb5712 clap upgrades
Richard Westhaver <ellis@rwest.io>
parents: 643
diff changeset
37
    :clap-warning
646
95fd920af398 error handling methods for clap
Richard Westhaver <ellis@rwest.io>
parents: 645
diff changeset
38
    :clap-unknown-argument
95fd920af398 error handling methods for clap
Richard Westhaver <ellis@rwest.io>
parents: 645
diff changeset
39
    :handle-unknown-opt
95fd920af398 error handling methods for clap
Richard Westhaver <ellis@rwest.io>
parents: 645
diff changeset
40
    :handle-missing-opt
95fd920af398 error handling methods for clap
Richard Westhaver <ellis@rwest.io>
parents: 645
diff changeset
41
    :handle-invalid-opt
95fd920af398 error handling methods for clap
Richard Westhaver <ellis@rwest.io>
parents: 645
diff changeset
42
    :handle-unknown-arg
95fd920af398 error handling methods for clap
Richard Westhaver <ellis@rwest.io>
parents: 645
diff changeset
43
    :handle-missing-arg
95fd920af398 error handling methods for clap
Richard Westhaver <ellis@rwest.io>
parents: 645
diff changeset
44
    :handle-invalid-arg
95fd920af398 error handling methods for clap
Richard Westhaver <ellis@rwest.io>
parents: 645
diff changeset
45
    :clap-missing-argument
649
6e5006dfe7b8 clap parsing updates
Richard Westhaver <ellis@rwest.io>
parents: 646
diff changeset
46
    :clap-invalid-argument
6e5006dfe7b8 clap parsing updates
Richard Westhaver <ellis@rwest.io>
parents: 646
diff changeset
47
    :activate-cmd
655
65102f74d1ae some optimizations, may have muddied the waters with cli-opt a bit though.. tbd
Richard Westhaver <ellis@rwest.io>
parents: 653
diff changeset
48
    :activate-opt
688
517c65b51e6b clap tests
Richard Westhaver <ellis@rwest.io>
parents: 661
diff changeset
49
    :find-opt
517c65b51e6b clap tests
Richard Westhaver <ellis@rwest.io>
parents: 661
diff changeset
50
    :cli-args
517c65b51e6b clap tests
Richard Westhaver <ellis@rwest.io>
parents: 661
diff changeset
51
    :opts
517c65b51e6b clap tests
Richard Westhaver <ellis@rwest.io>
parents: 661
diff changeset
52
    :cmds))
426
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
53
 
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
54
 (defpackage :cli/clap/ast
560
b9c64be96888 make cli/clap more dynamic
Richard Westhaver <ellis@rwest.io>
parents: 532
diff changeset
55
   (:use :cl :std :log :dat/sxp)
b9c64be96888 make cli/clap more dynamic
Richard Westhaver <ellis@rwest.io>
parents: 532
diff changeset
56
   (:export :cli-node :make-cli-node :cli-ast
426
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
57
    :make-cli-ast :cli-node-kind :cli-node-form))
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
58
 
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
59
 (defpackage :cli/clap/obj
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
60
   (:use :cl :std :log
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
61
    :sb-ext :cli/clap/proto :cli/clap/macs :cli/clap/util
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
62
    :cli/clap/vars :cli/clap/ast :cli/clap/util)
560
b9c64be96888 make cli/clap more dynamic
Richard Westhaver <ellis@rwest.io>
parents: 532
diff changeset
63
   (:import-from :dat/sxp :ast)
426
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
64
   (:export :make-cli :define-cli :defmain
532
f6a340b92274 tests and fixes, added sbcl tools
Richard Westhaver <ellis@rwest.io>
parents: 491
diff changeset
65
    :make-opts :make-cmds :parse-bool-opt :parse-string-opt
426
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
66
    :parse-form-opt :parse-list-op :parse-sym-op :parse-key-op
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
67
    :pasre-num-op :parse-file-op :parse-dir-op :cli
688
517c65b51e6b clap tests
Richard Westhaver <ellis@rwest.io>
parents: 661
diff changeset
68
    :cli-cd :with-cli :debug-opts
649
6e5006dfe7b8 clap parsing updates
Richard Westhaver <ellis@rwest.io>
parents: 646
diff changeset
69
    :cli-opt :cli-cmd :cli-opt-val :cli-opt-lock :cli-opt-name
653
119532882cb1 added keyword-opts (experimental)
Richard Westhaver <ellis@rwest.io>
parents: 649
diff changeset
70
    :active-cmds
688
517c65b51e6b clap tests
Richard Westhaver <ellis@rwest.io>
parents: 661
diff changeset
71
    :%compose-keyword-opt
517c65b51e6b clap tests
Richard Westhaver <ellis@rwest.io>
parents: 661
diff changeset
72
    :cli-cmd-args
517c65b51e6b clap tests
Richard Westhaver <ellis@rwest.io>
parents: 661
diff changeset
73
    :cli-lock-p
517c65b51e6b clap tests
Richard Westhaver <ellis@rwest.io>
parents: 661
diff changeset
74
    :cli-name))
426
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
75
 
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
76
 (defpackage :cli/clap/simple
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
77
   (:use :cl :std :log :sb-ext)
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
78
   (:import-from :cli/ansi :.ris)
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
79
   (:import-from :uiop :println)
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
80
   (:import-from :sb-ext :parse-native-namestring)
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
81
   (:shadowing-import-from :sb-ext :exit)
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
82
   (:export))
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
83
 
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
84
 (pkg:defpkg :cli/clap
3e721a3349a0 completed phase2 of clap migration
Richard Westhaver <ellis@rwest.io>
parents: 419
diff changeset
85
   (:nicknames :clap)
661
39170f311b8c add sk-def and sk-bind
Richard Westhaver <ellis@rwest.io>
parents: 655
diff changeset
86
   (:use-reexport :cli/clap/proto :cli/clap/obj :cli/clap/vars
623
a304c9713a51 init graph.el
Richard Westhaver <ellis@rwest.io>
parents: 567
diff changeset
87
    :cli/clap/simple :cli/clap/util :cli/clap/macs :cli/clap/ast
a304c9713a51 init graph.el
Richard Westhaver <ellis@rwest.io>
parents: 567
diff changeset
88
    :cli/clap/vars))