Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

usage-spec

Core types and rendering for usage spec.

Install

pip install usage-spec

API

Types

@dataclass
class Spec:
    name: str
    bin: str
    version: str
    about: str
    long: str
    usage: str
    flags: list[SpecFlag]
    args: list[SpecArg]
    cmds: list[SpecCommand]

Functions

from usage_spec import generate, render_kdl, render_json, validate_kdl

# Render Spec as KDL string
render_kdl(spec: Spec) -> str

# Render Spec as JSON string
render_json(spec: Spec) -> str

# Generate spec output with optional format and comment
generate(spec: Spec, format: str = "kdl", comment: str | None = None) -> str

# Validate KDL string by basic structural check
validate_kdl(kdl: str) -> None

License

MIT