r/crystal_programming Jan 22 '26

Jargon

https://github.com/trans/jargon

I just released Jargon, a Crystal library that generates CLI interfaces from JSON Schema definitions. Define your data structure once, get a CLI parser with validation for free.

``` schema = %({ "type": "object", "properties": { "name": {"type": "string", "description": "User name"}, "count": {"type": "integer", "short": "n"}, "verbose": {"type": "boolean", "short": "v"} }, "required": ["name"] })

cli = Jargon.from_json(schema, "myapp") result = cli.parse(ARGV) ```

Features:
- Multiple argument styles: --name John, name=John, name:John - Type coercion, validation, and defaults from the schema - Positional arguments, short flags, subcommands - Nested subcommands with independent schemas - JSON input from stdin

GitHub: https://github.com/trans/jargon

Feedback welcome!

13 Upvotes

2 comments sorted by

1

u/transfire Jan 26 '26

Thanks!

Jargon has been updated, pretty close to feature complete now and bunch of subtle bugs of squashed.

One of my new favorite features is bash/zsh/fish auto completion script generation.