Skip to content

[Improvement] Introduce picocli to improve command line interface #8576

@Abyss-lord

Description

@Abyss-lord

What would you like to be improved?

The current CLI is built on Apache Commons CLI, which has several limitations:

  1. Verbose code with scattered parameter definitions and parsing logic.
  2. Limited support for subcommands, making it hard to scale to complex CLI structures.
  3. Manual maintenance of help and usage messages, which is error-prone and inconsistent.
  4. Heavy reliance on mock systems in tests, delaying error detection and reducing reliability.

How should we improve?

We propose to migrate the CLI framework from Apache Commons CLI to Picocli.

  • Adopt an annotation-driven command definition to reduce boilerplate code.
  • Leverage Picocli’s built-in validation (@ArgGroup, type conversion, etc.) to eliminate manual validation logic.
  • Use hierarchical subcommand support (gcli [options]) for better organization and scalability.
  • Simplify testing by executing commands with real arguments instead of mocks, catching errors earlier.
  • Automatically generate colored, structured help messages and documentation (HTML, PDF).

document:https://docs.google.com/document/d/16J5r8P2nSTBF2XHZNf-8Ew82yfK0TSJKnFLkmJPLfHY/edit?tab=t.0
Draft:#8574

Command auto-correction

Image

Help message with color

Image

Metadata

Metadata

Assignees

Labels

improvementImprovements on everything

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions