Skip to content

CLI gen: only define about, not long_about#1380

Open
david-crespo wants to merge 1 commit into
mainfrom
cli-gen-about
Open

CLI gen: only define about, not long_about#1380
david-crespo wants to merge 1 commit into
mainfrom
cli-gen-about

Conversation

@david-crespo

@david-crespo david-crespo commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Explanation in code comment. I was dismayed to learn that in our CLI, -h and --help display different information. clap does this when you define both about and long_about. This PR stops doing that.

A less invasive alternative would be to keep defining about and long_about, but include both summary and description in long_about instead of just description. That would still be an improvement on the status quo, so I'd be in favor of it, but it does not fix the fact that -h and --help do different things, which to me is a little bizarre.

Before

-h displays the short description, --help displays the long one, but they are disjoint.

image image

After

image

The downside is we lose the cute listing of one-liners because the full descriptions get jammed in there. Personally I prefer this overall and I'm not sure more info in the list is necessarily a bad thing, but I can see how someone might disagree.

image

@david-crespo

Copy link
Copy Markdown
Contributor Author

Hand-written commands in the CLI will still have the about/long_about split, but in the better way that I describe above as the less-invasive alternative.

🤖 how hand-written commands in oxide.rs work

Every hand-written subcommand (cmd_api, cmd_auth, cmd_disk, cmd_instance, cmd_net, cmd_support_bundle, cmd_completion) is a #[derive(Parser)] with #[command(verbatim_doc_comment)] and a multi-paragraph /// doc comment. clap's derive macro maps that the same way progenitor used to:

  • first paragraph (up to the first blank line) → about
  • whole commentlong_about

So e.g. oxide api -h shows only:

Make an authenticated HTTP request to the Oxide API and print the response.

while oxide api --help shows the full multi-paragraph prose about --field, @file, --paginate, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant