cligen

command
v1.22.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command cligen generates the resource commands of the bma CLI (cmd/bma/api_gen.go) from the public BMA OpenAPI document (ADR-0102): every operation becomes one entry of apiOperations, from which cmd/bma builds a cobra command. Never edit api_gen.go by hand; regenerate:

go run ./tools/cligen -spec contracts/bma-api/bma.openapi.yaml -out cmd/bma/api_gen.go

Naming: the path's resource segments are the command groups and the operation is the verb. A trailing segment after a path parameter is a sub-resource (its own group) when the document lists it or has items below it; otherwise it is an action and its name is the verb (POST /v1/sessions/{id}/archive -> `bma sessions archive <id>`). Collection GET is list, collection POST create, item GET get, item POST/PUT/PATCH update, item DELETE delete. Names are kebab-case.

Operations a generic request cannot express are marked HandWritten and covered by hand-written commands that name the operation in their "operation" annotation: event streams (text/event-stream) and multipart uploads; and the operations with a top-level command of their own (topLevel). cmd/bma's parity test checks that every operation has exactly one command and every generated command an operation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL