kebab

Declarative, type-safe command line parsing for Crystal

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/:

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