changelog shortlog graph tags branches changeset files revisions annotate raw help

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

changeset 698: 96958d3eb5b0
parent: b9c64be96888
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 ;;; cli/clap/ast.lisp --- Clap AST
2 
3 ;;
4 
5 ;;; Code:
6 (in-package :cli/clap/ast)
7 
8 ;; typically when starting from a top-level CLI, the global
9 ;; CLI-OPTS will be parsed first, followed by the first command
10 ;; found. If a command is found, the tail of the list is passed as
11 ;; arguments to this function, which can pass additonal arguments to
12 ;; nested commands.
13 
14 ;; TODO 2023-09-12: Parsing restarts at the `*cli-group-separator*'
15 ;; if present, or stops at EOI.
16 (defstruct (cli-node (:constructor make-cli-node (kind form))) kind form)
17 
18 (defstruct (cli-ast (:constructor make-cli-ast (ast))) ast)
19 
20 (defmethod ast ((self cli-ast))
21  (cli-ast-ast self))
22 
23 (defgeneric proc-args (self args))
24 
25 (defgeneric parse-args (self args &key &allow-other-keys)
26  (:documentation "Parse list of strings ARGS using SELF.
27 
28 A list of the same length as ARGS is returned containing 'cli-ast'
29 objects: (OPT . (or char string)) (CMD . string) NIL"))