kebab
Kebab
WIP. Public API is subject to change.
Installation
Add the dependency to your shard.yml:
dependencies:
kebab:
github: DanielGilchrist/kebab
Then run shards install.
Quick example
require "kebab"
@[Kebab::Command(summary: "Greet someone")]
struct Greet
include Kebab::Parseable
@[Kebab::Argument(description: "Name to greet")]
getter name : String
@[Kebab::Option(short: 'l', description: "Make it loud")]
getter? loud : Bool = false
end
case result = Greet.parse # args default to ARGV
in Greet
message = "Hello, #{result.name}!"
message = message.upcase if result.loud?
puts message
in Kebab::Help
puts result # the user passed --help
in Kebab::Errors
STDERR.puts result # parsing failed
exit(1)
end
When a command owns its logic, give it a def run and dispatch with Type.run, which parses, runs on success, and writes help and errors for you.
Examples
Runnable walkthroughs in examples/:
examples/parsing/: kebab as a pure parser, nodef run.examples/command/: single-command pattern withType.run.examples/subcommands/: multi-level command tree.examples/errors/: typed error dispatch in parsing mode.examples/suggestions/: in-command error handlers with "did you mean" hints.examples/completions/: generating fish, bash, and zsh completions.examples/global/: options usable anywhere in a command's subtree withglobal: true.examples/collections/: repeated options, value groups, converters, and variadic arity.examples/counting/: counting flag occurrences withcount: true, like-vvv.examples/testing/: testing commands with parse, injected dependencies, and captured IO.
API docs
Generate them with crystal docs from the repo root.
Repository
kebab
Owner
Statistic
- 0
- 0
- 0
- 3
- 1
- 9 days ago
- June 14, 2026
License
MIT License
Links
Synced at
Thu, 16 Jul 2026 20:25:38 GMT
Languages