module

Jargon

Jargon builds a command-line parser from a JSON Schema: the schema is the single source of truth for a CLI's options, types, validation, help text, and shell completion. Start from Jargon.cli (flat CLI) or Jargon.new (subcommand mode), then parse/run the arguments.

Constants

VERSION = "0.20.0"

Constructors

new(program_name : String) : CLI

Create an empty CLI to attach subcommands to (subcommand mode).

Source

Class methods

cli(program_name : String, *, json : String) : CLI

Create a CLI from a schema. The schema source is given by a named argument: json:, yaml:, or file: (extension-detected). A multi-document schema is auto-detected and loaded as subcommands.

Source
cli(program_name : String, *, file : String) : CLI

Create a CLI from a schema. The schema source is given by a named argument: json:, yaml:, or file: (extension-detected). A multi-document schema is auto-detected and loaded as subcommands.

Source
cli(program_name : String, *, yaml : String) : CLI

Create a CLI from a schema. The schema source is given by a named argument: json:, yaml:, or file: (extension-detected). A multi-document schema is auto-detected and loaded as subcommands.

Source
config_warnings=(config_warnings : Bool)

Control whether config parse warnings are emitted to STDERR

Source
config_warnings?

Control whether config parse warnings are emitted to STDERR

Source
flatten(schema : String) : String

Flatten a schema by resolving all $ref pointers and removing $defs. Useful for AI tool definitions that don't support $ref.

Source
from_file(path : String, program_name : String = "cli") : CLI

DEPRECATED Use Jargon.cli(program_name, file: path) instead

Source
from_json(json : String, program_name : String = "cli") : CLI

DEPRECATED Use Jargon.cli(program_name, json: schema) instead

Source
merge(sub : String, global : String) : String

Merge global schema properties into a subcommand schema. Properties from global are added to sub (sub takes precedence if both define same key).

Source

Nested types