apache / apache/gravitino

[Improvement] Introduce picocli to improve command line interface

Open
#8,576 14 comments 0 reactions 1 assignee Claimed by @Abyss-lord View on GitHub
improvement
Dominant language
Java
Stars
3.2k
Forks
935
Avg merge
1d 16h
Merged PRs (30d)
298

Description

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.