changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/cli/clap/proto.lisp

changeset 645: 3e6a17fb5712
parent: e49442cd6010
child: 95fd920af398
author: Richard Westhaver <ellis@rwest.io>
date: Wed, 11 Sep 2024 17:24:07 -0400
permissions: -rw-r--r--
description: clap upgrades
1 ;;; cli/clap/proto.lisp --- Clap Protocol
2 
3 ;;
4 
5 ;;; Code:
6 (in-package :cli/clap/proto)
7 
8 (define-condition clap-condition () ())
9 (eval-always
10  (deferror clap-error (clap-condition) ())
11  (defwarning clap-warning (clap-condition) ())
12  (deferror clap-simple-error (simple-error clap-error) () (:auto t))
13  (deferror clap-unknown-argument (clap-error unknown-argument) ())
14  (defwarning clap-simple-warning (simple-warning clap-warning) () (:auto t)))
15 
16 (defun clap-unknown-argument (opt)
17  (error 'clap-unknown-argument :name opt :kind 'cli-opt))
18 
19 (defgeneric push-cmd (cmd place))
20 
21 (defgeneric push-opt (opt place))
22 
23 (defgeneric pop-cmd (place))
24 
25 (defgeneric pop-opt (place))
26 
27 (defgeneric find-cmd (self name &optional active))
28 
29 (defgeneric find-opts (self name &key active recurse))
30 
31 (defgeneric active-cmds (self))
32 
33 (defgeneric active-opts (self &optional global))
34 
35 (defgeneric find-short-opts (self ch &key))
36 
37 (defgeneric call-opt (self arg))
38 
39 (defgeneric do-opt (self))
40 
41 (defgeneric do-opts (self &optional global))
42 
43 (defgeneric call-cmd (self args opts))
44 
45 (defgeneric do-cmd (self)
46  (:documentation "Run the command SELF with args parsed at runtime."))
47 
48 (defgeneric print-help (self &optional stream)
49  (:documentation "Format cli SELF as a helpful string."))
50 
51 (defgeneric print-version (self &optional stream)
52  (:documentation "Print the version of SELF."))
53 
54 (defgeneric print-usage (self &optional stream)
55  (:documentation "Format cli SELF as a useful string."))
56 
57 (defgeneric handle-unknown-argument (self arg)
58  (:documentation "Handle an unknown argument."))
59 
60 (defgeneric handle-missing-argument (self arg)
61  (:documentation "Handle a missing argument."))
62 
63 (defgeneric handle-invalid-argument (self arg)
64  (:documentation "Handle an invalid argument."))
65 
66 (defgeneric cli-equal (a b))