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 6 (in-package :cli/clap/proto) 8 (define-condition clap-condition () ()) 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))) 16 (defun clap-unknown-argument (opt) 17 (error 'clap-unknown-argument :name opt :kind 'cli-opt)) 19 (defgeneric push-cmd (cmd place)) 21 (defgeneric push-opt (opt place)) 23 (defgeneric pop-cmd (place)) 25 (defgeneric pop-opt (place)) 27 (defgeneric find-cmd (self name &optional active)) 29 (defgeneric find-opts (self name &key active recurse)) 31 (defgeneric active-cmds (self)) 33 (defgeneric active-opts (self &optional global)) 35 (defgeneric find-short-opts (self ch &key)) 37 (defgeneric call-opt (self arg)) 39 (defgeneric do-opt (self)) 41 (defgeneric do-opts (self &optional global)) 43 (defgeneric call-cmd (self args opts)) 45 (defgeneric do-cmd (self) 46 (:documentation "Run the command SELF with args parsed at runtime.")) 48 (defgeneric print-help (self &optional stream) 49 (:documentation "Format cli SELF as a helpful string.")) 51 (defgeneric print-version (self &optional stream) 52 (:documentation "Print the version of SELF.")) 54 (defgeneric print-usage (self &optional stream) 55 (:documentation "Format cli SELF as a useful string.")) 57 (defgeneric handle-unknown-argument (self arg) 58 (:documentation "Handle an unknown argument.")) 60 (defgeneric handle-missing-argument (self arg) 61 (:documentation "Handle a missing argument.")) 63 (defgeneric handle-invalid-argument (self arg) 64 (:documentation "Handle an invalid argument.")) 66 (defgeneric cli-equal (a b))