cliq
Version, currently 1.0.03 versions
- 2.0.0latestMay 26, 2023
- 1.0.1not indexedMay 26, 2023
- 1.0.0not indexedMay 26, 2023
github.com/busyloop/cliq
CLI Framework
Nothing has been indexed for 1.0.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
cliq:
github: busyloop/cliq
version: ~> 1.0.0Then run:
shards installshard.yml
No shard.yml has been indexed for 1.0.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
Cliq

The quick way to create a user-friendly Command Line Interface in Crystal. ⚡powered by Toːka

Features
- Easily create a CLI with nested sub-commands and complex flags
- Automatic help screens, argument type coercion, input validation and meaningful error messages
Installation
-
Add the dependency to your
shard.yml:dependencies: cliq: github: busyloop/cliq -
Run
shards install
Basic Usage
require "cliq"
class GreetPerson < Cliq::Command
command "greet person"
summary "Greet someone"
description "I greet, therefore I am"
args ["<name> Name to greet"]
flags({
yell: Bool?,
count: {
type: Int32,
default: 1,
value_name: "TIMES",
description: "Print the greeting this many times"
}
})
def call(args)
raise Cliq::Error.new("Must provide a <name>") if args.size < 1
greeting = "Hello #{args[0]}!"
greeting = greeting.upcase if @yell
@count.times { puts greeting }
end
end
# Let's go!
Cliq.invoke(ARGV)
How it works
- You can have any number of
Cliq::Commandsubclasses in your program.
Cliq merges them together to form the final CLI. - Each must have a method
#call(args : Array(String)). - Use
commandto declare the command name- Spaces are allowed.
If you want a sub-commandfoo bar batzthen just put exactly that in there.
- Spaces are allowed.
- Use
summaryto declare a short text to be displayed in the command list (top level help screen) - Use
descriptionto declare a longer text to be displayed in the command help screen (./foo bar --help) - Both
summaryanddescriptioncan be multi-line strings and will be auto-indented as needed - Use
argsto describe positional arguments- Takes an Array of String's in format
"[foo] Description"
- Takes an Array of String's in format
- Use
flagsto declare the flags that your command accepts - See examples/demo.cr for a demo with multiple sub-commands
The flags-macro
Short-hand syntax
flags({
verbose: Bool?,
count: Int32
})
This allows --verbose or -v
and requires --count N or -c N (where N must be an integer).
Long-hand syntax
flags({
verbose: {
type: Bool,
nilable: true,
description: "Enable verbosity"
}
count: {
type: Int32,
description: "Print the greeting this many times",
verifier: ->(n : Int32){ n >= 0 || "Must be greater than zero" }
}
})
Reference
typeThe type. Examples:String,Int32?,Array(String)nilableIf the type is optional ("nil-able"). You can also make thetypenilable for the same effect.defaultThe default value.descriptionThe human-readable description. Can be multi-line.longAllows to manually configure long-options. Auto-generated from the name otherwise.shortAllows to manually configure short-options. Auto-generated otherwise. Set tofalseto disable.value_nameHuman-readable value name, shown next to the option name like:--foo=HEREcategoryHuman-readable category name, for grouping in the help page. Optional.value_converterConverter to use for the value.key_converterConverter for the key to use for aHashtype.verifierVerifier to validate the value.
Credits
Cliq is a thin wrapper around Toːka. Please refer to the Toːka documentation for advanced usage.
If you do not need sub-commands in your program then you should consider using Toːka directly.
Contributing
- Fork it (https://github.com/busyloop/cliq/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
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.0.0- Tagged
- May 26, 2023
- Commit
ae4d82b06c93- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/busyloop/cliq
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 3