Schema-first validation
Required fields, enum constraints, and strict type checks are all derived from your JSON Schema.
Jargon turns JSON Schema into a precise, user-friendly CLI. You get validation, defaults, subcommands, and completions with a single definition, delivered as clean JSON, in Crystal or Rust.
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "User name"
},
"age": {
"type": "integer",
"description": "User age",
"default": 0
},
"verbose": {
"type": "boolean",
"short": "v"
}
},
"required": ["name"]
}
Define the data shape once and reuse it everywhere.
Describe data types, defaults, env overrides, and descriptions.
Jargon validates inputs and produces consistent JSON output.
Automatic help, completions, and subcommands come built in.
A tiny demo script that shows parsing, nesting, and validation.
Jargon keeps the CLI surface area predictable, while still letting you express complex data shapes with nested objects and refs.
Required fields, enum constraints, and strict type checks are all derived from your JSON Schema.
Loads config from standard XDG paths with project overrides.
Schema defaults, config files, and env vars layer predictably.
Map options to env vars and coerce types automatically.
Compose nested sub-parsers, with a default command fallback.
Mix ordered arguments with a variadic tail for lists.
Accept --flags or bare key=value without extra parsing.
Use dotted keys like user.name for deep objects.
Parse full JSON payloads via stdin with a single dash.
Auto-generated help plus typo suggestions for options.
Share definitions via $ref and keep specs DRY.
Generate bash, zsh, and fish scripts from the same schema.
Generate scripts for bash, zsh, and fish straight from your schema.
Jargon can emit shell completion scripts without any extra tooling. Hook them into your install process or generate on demand.
cli = Jargon.cli("mycmd", json: schema)
puts cli.bash_completion
puts cli.zsh_completion
puts cli.fish_completion
Help output reads like docs because descriptions come from the schema.
Perfectly concise help messages that stay readable and focused. Deep dives belong in man pages, not in the CLI overview.
Usage: mycmd [options]
Options:
-v, --verbose [default: false]
Enable verbose logging
--count=<integer> [default: 10]
Number of retries
--mode=<string>
Operation mode
Add the shard or the crate, load a schema, and parse.
Add Jargon to your shard.yml and run shards update,
or add it to your Cargo.toml. Then define your schema, wire it
up in your code (easy peasy), and enjoy a friendly CLI.
# shard.yml
dependencies:
jargon:
github: openbohemians/jargon.cr
Contribute, explore the docs, or ship Jargon in your next CLI.
Jargon is MIT-licensed and built to be hacked on. Open issues, send PRs, or browse the API docs to dive deeper.
Schema-driven help, JSON output, and shell completions make it easy to ship polished command lines quickly.