kebab
Version, currently main branch1 version
- main branchlatestJul 16, 2026
github.com/DanielGilchrist/kebab
Declarative, type-safe command line parsing for Crystal
0 stars
3 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
kebab:
github: DanielGilchrist/kebab
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.20.0- License
- MIT
- Author
- Daniel Gilchrist
Dependencies
Development Dependencies
- ameba~> 1.6github: crystal-ameba/amebadev
README
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.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Jul 16, 2026
- Crystal
>= 1.20.0- Indexed
- yes
Dependents
Repository
github.com/DanielGilchrist/kebab
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1