kommando
Version, currently 0.1.32 versions
- 0.1.3latestNov 16, 2025
- 0.1.2not indexedNov 16, 2025
github.com/Ragmaanir/kommando
Define CLI commands in crystal
1 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
kommando:
github: Ragmaanir/kommando
version: ~> 0.1.3Then run:
shards installshard.yml
- Crystal
>= 1.18.0- License
- MIT
- Author
- Ragmaanir
Dependencies
Development Dependencies
- ameba~> 1.4github: veelenga/amebadev
- microtest*github: ragmaanir/microtest, branch: masterdev
README
Kommando 
Version 0.1.3
Kommando is a library that helps you build small and large command line interfaces in crystal.
Installation
Add this to your application's shard.yml:
dependencies:
kommando:
github: ragmaanir/kommando
Features
- positional arguments (like in
crystal init app MyApp) - short and long options (like
cli new MyProject --dry -v --permissions=644 --repo=github -l=MIT) - validation and type conversion of arguments
- auto-generated documentation
- namespaces/subcommands like
cli create user Toby
Rationale
Why classes for commands and not methods
Classes can define helper methods that are scoped to the command. And the helper methods have access to all options of the command.
Usage
Commands
record(User, name : String, age : Int32, height : Int32?, nickname : String?)
USERS = [] of User
class Create
include Kommando::Command
option(:height, Int32, "", validate: ->(v : Int32) { (100..250).includes?(v) })
option(:nickname, String, "", format: /\A[a-zA-Z]+\z/)
option(:dead, Bool, "Whether the person is dead", default: false)
arg(:name, String)
arg(:age, Int32)
def call
USERS << User.new(name, age, @height, @nickname)
end
end
test "create user with options" do
user = User.new("Christian", 55, 175, "Chris")
Create.call([
"-height=#{user.height}",
"-nickname=#{user.nickname}",
user.name, user.age.to_s,
])
assert USERS == [user]
end
Namespaces
require "kommando"
class Create
include Kommando::Command
def call
end
end
class Migrate
include Kommando::Command
def call
end
end
test do
root = Kommando::Namespace.root do
commands Create
namespace("db") do
commands Create, Migrate
end
end
assert root.commands.keys == ["create"]
assert root.namespaces.keys == ["db"]
root.run(["db", "create"])
end
Contributing
- Fork it (https://github.com/ragmaanir/kommando/fork)
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- ragmaanir ragmaanir - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.3- Tagged
- Nov 16, 2025
- Commit
ea8b6b3d4790- Crystal
>= 1.18.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/Ragmaanir/kommando
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 2