Crystal’s standard library gives you OptionParser and nothing else. That is fine for a 40-line script and painful the moment you need subcommands, typed flags, shell completion and generated help that does not look hand-rolled. Three shards have historically filled that gap — and two of them have not received a commit since 2021.

This matters more than usual in 2026. Crystal 1.13+ tightened macro semantics and shipped changes to OptionParser internals that break older shard code in subtle ways. Picking a CLI framework is now a maintenance decision, not a taste decision.

TL;DR — the quick verdict

Use athena-console (Athena::CLI) if you are building anything you intend to maintain past this quarter. It is the only one of the three with commits in 2026, it requires Crystal ~> 1.13, and it gives you Symfony-Console-style commands with colour IO, argument validation and completion for free.

Use Admiral if you inherited a codebase that already depends on it and you cannot afford a rewrite this sprint. Its DSL is genuinely pleasant, but you are pinning yourself to a shard last touched 2021-07-15.

Use Clim only for tiny throwaway tools — or skip all three and hand-roll OptionParser. Clim’s last commit is 2021-04-11 and its “slim” philosophy means you will write most of the glue yourself anyway.

If you need a one-line rule: new project → Athena::CLI; existing project → stay put and budget a migration.

The numbers, pulled today

Star counts and last-push dates below come straight from the GitHub API, not from memory. Anything older than a year is flagged.

DimensionAthena::CLI (athena-console)AdmiralClim
Repositoryathena-framework/athena (console component)jwaldrip/admiral.crat-grandpa/clim
Stars240 (whole monorepo) / 23 (console repo)144126
Last commit2026-12-012021-07-152021-04-11
LicenseMITMITMIT
Declared Crystal support~> 1.131.0.0 (0.34.0+)0.17.1 release line
SubcommandsYes, nestedYesYes, nested
Typed flagsYesYes (UInt32, Array, …)Yes (25+ types)
Bash completionYes (built-in command)NoYes
Dependency injectionYes, first-classNoNo
StyleSymfony Console portDSL class inheritanceDSL block-based
Maintenance riskLowHighHigh

Note the star-count trap: Admiral’s 144 stars look respectable next to Athena’s console repo at 23. Stars measure 2019-era popularity, not 2026 health. The monorepo that actually contains the console component has 240 and shipped this month.

Decision matrix

Your situationPickWhy
New CLI, long-lived, needs completionAthena::CLIOnly actively maintained option; completion is a built-in command
Existing Admiral shard, Crystal 1.0-era codeAdmiral (frozen version)Migration cost exceeds the benefit unless you also upgrade Crystal
100-line internal toolOptionParserZero dependencies, zero abandonment risk
You want nested subcommands with minimal APIClimNested commands are its strongest feature — accept the risk
CLI that shares models with an HTTP appAthena::CLIIts container integration is the differentiator
Static binary you ship to usersAthena::CLIBest long-term story for compile-time checks and specs

Athena::CLI — the maintained option

Athena::CLI ships as the athena-console shard inside the Athena monorepo. It is a port of Symfony Console’s architecture: an ACON::Application holds a command loader, dispatches by name, and each ACON::Command declares its own arguments and options. The class names are confirmed in the project’s own specs — ACON::Application.new "foo", ACON::Command, plus annotation-driven command configuration where name, description, aliases and hidden are read from annotations rather than code.

1
2
3
4
5
# shard.yml — verified against athena-framework/console shard.yml (v0.5.0)
dependencies:
  athena-console:
    github: athena-framework/console
    version: ~> 0.5.0
1
2
3
4
5
require "athena-console"

# Application owns the command registry and the IO abstraction.
application = ACON::Application.new "myapp"
application.run
1
2
3
4
$ shards install
$ crystal build --release src/myapp.cr -o bin/myapp
$ ./bin/myapp list          # every registered command, with descriptions
$ ./bin/myapp help greet    # generated usage, options and arguments

What you actually get for that dependency:

  • Annotation-configured commands. The spec suite literally asserts that an annotation-configured command ends up with name == "annotation:configured", a description, aliases and a hidden flag. That means you can move command metadata out of code and into attributes, which is the Symfony ergonomic that Admiral and Clim never had.
  • A real IO layer. Output goes through an interface with styling helpers instead of puts. Anything you print is testable.
  • Container integration. Athena’s dependency-injection component creates commands, so a command can receive a repository or HTTP client by constructor injection.
  • Completion as a command. Not a shell snippet you paste into .bashrc — a command in the application.

The trade-off is weight: athena-console 0.5.0 depends on athena-clock, drags in a DI container, and pins Crystal to ~> 1.13. For a five-flag script that is overkill. For a tool with ten subcommands and tests, it is the only option here that will still build in 2028.

Admiral — great DSL, frozen codebase

Admiral’s model is inheritance: you subclass Admiral::Command, implement run, and declare flags with macros. The README’s typed-flag example is still the cleanest CLI DSL in Crystal:

1
2
3
4
# shard.yml
dependencies:
  admiral:
    github: jwaldrip/admiral.cr
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
require "admiral"

class HelloWorld < Admiral::Command
  define_flag number_of_greetings : UInt32, default: 1_u32, long: times

  def run
    flags.times.times do
      puts "Hello World"
    end
  end
end

HelloWorld.run
1
2
3
4
5
$ crystal build ./hello_world.cr
$ ./hello_world --times 3
Hello World
Hello World
Hello World

Three details worth knowing before you adopt it:

  1. Underscores become hyphens on the command line. define_flag number_of_greetings is invoked as --number-of-greetings unless you override it with long:. This is documented, and it silently breaks scripts when someone assumes otherwise.
  2. define_flag planet returns String | Nil. Typed flags need the explicit type annotation; the union with Nil is what makes flags.planet || "World" necessary.
  3. HelloWorld.run reads ARGV by default, but accepts an Array(String) or a String, which is exactly what you want in specs.

The problem is not the API. The problem is that pushedAt is 2021-07-15, the README still advertises Crystal 1.0.0 compatibility, and the CI badge points at Travis. Crystal has shipped six minor versions since. It compiles today for most DSL usage, but nobody is fixing it when it stops.

Clim — slim, and that is the point

Clim inverts Admiral’s design: instead of a class per command with macro-declared flags, you build a tree of blocks. Options and arguments are declared inside main do (or inside a subcommand block), and the run block receives parsed options and arguments.

1
2
3
4
5
# shard.yml
dependencies:
  clim:
    github: at-grandpa/clim
    version: 0.17.1
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
require "clim"

class MyCli < Clim
  main do
    run do |opts, args|
      puts "#{args.all_args.join(", ")}!"
    end
  end
end

MyCli.start(ARGV)
1
2
3
$ crystal build -o ./minimum src/minimum.cr
$ ./minimum foo bar baz
foo, bar, baz!

Its declared type coverage is genuinely broad for a 126-star shard: Int8 through UInt64, Float32/Float64, String, Bool, and array variants of every numeric type for both options and arguments, plus default values, required flags, nested subcommands, command aliases, --help, a version macro and bash completion.

1
2
3
4
5
6
7
8
9
class Cli < Clim
  main do
    desc "Hello CLI tool."
    usage "hello [options] [arguments] ..."
    version "Version 0.1.0"
    option "-g WORDS", "--greeting=WORDS", type: String, desc: "Words of greetings.", default: "Hello"
    argument "first_member", type: String, desc: "first member name.", default: "member1"
  end
end

The catch is that Clim’s last commit is 2021-04-11 and the pinned release in its own README is 0.17.1. You also pay for “slim”: no DI, no annotation metadata, no IO abstraction, and completion that you wire up yourself. For a subcommand tree inside a 300-line tool it is still the least ceremony you will find in Crystal — just accept that you own the code now.

Migration and upgrade pitfalls

Lock the exact shard version and commit shard.lock. All three projects have long gaps between releases. A version: ~> 0.17.1 range plus an unlocked CI checkout is how a working build turns red on a Tuesday morning.

Crystal 1.13 is a hard boundary for the abandoned shards. If you upgrade the compiler first, expect macro errors from define_flag expansions and from Clim’s block DSL before you see anything about your own code. Upgrade Crystal and the CLI shard in the same branch, and only after you have a green test suite on the old compiler.

Do not mix DSL styles in one binary. Admiral’s Admiral::Command#run and Clim’s Clim#main both assume they own ARGV. If you embed one inside the other — for example to add a new subcommand to an existing Admiral tool — you get double parsing where the second parser sees the already-consumed flags. Write a thin router instead, or migrate the whole entry point.

Static binaries are the reason to pick Crystal here. crystal build --release --static produces a single file you can drop on a server with no runtime. All three frameworks work with it; only Athena is actively tested against current Crystal.

Ship specs, not manual QA. Both Admiral and Clim accept an argument vector instead of ARGV, so a spec can call the command with ["--times", "3"] and assert on captured output. Athena goes further: its application_tester and command_tester components exist precisely so you can assert on exit status and IO without spawning a process.

1
2
# Admiral-style testability — pass ARGV explicitly, no process spawn
HelloWorld.run(["--times", "2"].map(&.as(String)))

Why this comparison matters beyond Crystal

Crystal is not the only ecosystem where the “obvious” CLI library is quietly dead. If you run self-hosted tooling, the same question shows up in every language: is the library you are pinning still receiving patches, or are you adopting a dependency that will block your next runtime upgrade? We walked through the same analysis for OCaml in our OCaml CLI frameworks comparison, and the pattern repeats — a well-designed DSL with a stale maintenance tail.

For Crystal specifically, the practical rule is to keep the CLI layer thin so a migration is a day, not a quarter. If your commands talk to a database, keep that access behind one module — our Crystal database libraries comparison covers which shard to put there, and the Crystal HTTP client comparison covers the outbound side. With those two boundaries in place, swapping Admiral::Command for an ACON::Command is mechanical: rename the class, move flags into the configure step, keep run/execute bodies untouched.

FAQ

Is Admiral still maintained in 2026?

No. The repository jwaldrip/admiral.cr has not received a commit since 2021-07-15. It still compiles for typical DSL usage and the README claims support back to Crystal 0.34.0, but there is no active maintainer responding to compiler-compatibility regressions.

Which Crystal CLI framework works with Crystal 1.13?

athena-console (Athena::CLI) declares crystal: ~> 1.13 in its shard manifest and shipped a release in December 2026, so it is the only one of the three with explicit support for the current compiler line. Admiral and Clim were last released in 2021 and have no declared compatibility with 1.13+.

Do I need a framework at all, or is OptionParser enough?

For a single command with a handful of flags, OptionParser from the standard library is the correct answer — zero dependencies and zero abandonment risk. Adopt a framework when you need subcommands, shell completion, generated help, or typed arrays of flags; that is where hand-rolled parsing starts costing more than a dependency.

Can Admiral and Clim generate shell completion?

Clim supports bash completion and documents it as a feature. Admiral does not ship completion generation. Athena::CLI exposes completion as a built-in command, which is the most maintainable of the three because the completion logic ships with the application binary rather than as an external script.

How do I test a Crystal CLI without spawning a process?

Pass an explicit argument vector instead of ARGV: Admiral’s run accepts an Array(String), and Clim’s start accepts the same. For Athena::CLI, use its command_tester and application_tester components, which let you assert on output and exit status directly.

Is it worth migrating an existing Admiral tool to Athena::CLI?

Only if you are also upgrading Crystal, or if the tool is growing subcommands and you need DI and completion. The migration itself is small — class rename, flags moved into the configure step, unchanged run body — but the regression surface is your argument parsing, which is exactly the part users notice when it breaks.


💰 想测试你的市场判断力?我用 Polymarket 做预测市场交易——这是全球最大的预测市场平台,从大选结果到技术监管时间线,什么都可以押注。和赌博不同,这是真正的信息市场:你懂的信息越多,胜率越高。我靠预测技术相关事件的走向已经赚了不少。用我的邀请链接注册:Polymarket.com