Skip to content

feat(ui): add main_cli_help.sh — clap option-ordering test#188

Merged
CGMossa merged 1 commit into
mainfrom
feat/ui-cli-help
May 17, 2026
Merged

feat(ui): add main_cli_help.sh — clap option-ordering test#188
CGMossa merged 1 commit into
mainfrom
feat/ui-cli-help

Conversation

@CGMossa
Copy link
Copy Markdown
Contributor

@CGMossa CGMossa commented May 1, 2026

AI-written details

Summary

Adds ui/main_cli_help.sh (139 lines) — a UI regression test that captures the full --help output for dvs init / add / get / status so the clap option-ordering layout is pinned down and visible in the published HTML. Anyone refactoring CommonOpts / Cli / per-command structs has an obvious diff to compare against.

Supporting changes:

dvs-cli/src/main.rs (+6/−2):

  • #[command(next_display_order = 100)] on each subcommand variant (Init, Add, Status, Get) so per-command options render in a stable order regardless of insertion order.
  • display_order = 0 / display_order = 1 on the two global flags (--json, --threads) so they appear at the top of every command's Options section.

justfile (+4/−2):

  • Register cli_help in ui_names so just ui-run / ui-render / ui-publish pick the new script up.
  • ui-publish-only: conditionally include ui/helpers.sh as a source attachment only when the target script actually sources it. main_cli_help.sh deliberately doesn't source helpers.sh (no set -x, no say) so the published log has no xtrace noise.

History note

Squashed from 10 commits into 1. The intermediate history contained: two abandoned CommonOpts-flatten attempts that mutually reverted, a disable_help_subcommand = true change that was reverted (the help subcommand row is back), 2 cargo-fmt commits, and a doc-refresh churn that moved to #189. The net diff is small and self-contained.

Rejected approaches (kept here for posterity)

  • help_heading = "Global Options": arbitrary heading text.
  • next_display_order = 1000 on a top-level GlobalOpts flatten: arbitrary magic number, restructures globals.
  • CommonOpts #[derive(Args)] flattened into each variant: turns globals from pre-subcommand-allowed into subcommand-only.

Test plan

  • just install-all && bash ui/main_cli_help.sh runs to completion (exit 0)
  • Output makes the ordering match obvious for all four subcommands
  • just ui-publish publishes ui-cli_help to alx without error
  • dvs --json <sub> and dvs <sub> --json both work (globals still global)
  • Existing ui/main_*.sh scripts continue to pass

Notes


Drafted by Claude (claude-opus-4-7). Reviewed by the author.

@CGMossa CGMossa force-pushed the feat/ui-cli-help branch 2 times, most recently from 1404266 to 3c990d3 Compare May 1, 2026 20:34
@Keats
Copy link
Copy Markdown
Collaborator

Keats commented May 4, 2026

We decided to keep things as currently.

@Keats Keats closed this May 4, 2026
@CGMossa
Copy link
Copy Markdown
Contributor Author

CGMossa commented May 4, 2026

We did decide that. But I am adjusting the UI scripts so the testing/validation can stay in the repo.

@CGMossa
Copy link
Copy Markdown
Contributor Author

CGMossa commented May 4, 2026

Outputs from the UI tests can be viewed here https://alx.dev.a2-ai.cloud/artifact/a0d5be27-7c84-4572-9a40-cff60ea50a88

@CGMossa CGMossa force-pushed the feat/ui-cli-help branch from 1335341 to 79bcfb7 Compare May 4, 2026 08:55
Comment thread dvs-cli/src/main.rs Outdated
@CGMossa
Copy link
Copy Markdown
Contributor Author

CGMossa commented May 5, 2026

The help command isn't a problem. I'm removing this disable_help_subcommand, and retain the default clap behavior.

CGMossa added a commit that referenced this pull request May 5, 2026
Collapse the multi-line `#[clap(...)]` attribute on `Cli` into one line.
Fixes the `cargo fmt --all --check` step on CI for #188.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CGMossa added a commit that referenced this pull request May 16, 2026
Collapse the multi-line `#[clap(...)]` attribute on `Cli` into one line.
Fixes the `cargo fmt --all --check` step on CI for #188.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@CGMossa CGMossa force-pushed the feat/ui-cli-help branch from fe1b5b1 to 8ecbd49 Compare May 16, 2026 09:24
Adds `ui/main_cli_help.sh` (139 lines) capturing the full `--help`
output for `dvs init / add / get / status` so the option-ordering
behavior of the current clap layout is pinned down and visible in
the published UI HTML. Anyone refactoring `CommonOpts` /
`Cli` / per-command structs has an obvious diff to compare against.

Supporting changes:

- dvs-cli/src/main.rs:
  - `#[command(next_display_order = 100)]` on each subcommand so
    per-command options render in a stable order regardless of
    insertion order.
  - `display_order = 0/1` on the two global flags (`--json`,
    `--threads`) so they appear at the top of every command's
    options block.

- justfile:
  - Register `cli_help` in `ui_names` so `just ui-run` /
    `ui-render` / `ui-publish` pick the new script up.
  - `ui-publish-only`: conditionally include `ui/helpers.sh` as a
    source attachment only when the target script actually sources
    it (`main_cli_help.sh` doesn't).

Squashed from 10 commits (multiple reverts of an abandoned
CommonOpts flatten experiment + 2 cargo-fmt commits + doc churn
moved to #189) — the net diff is small and stands on its own.
@CGMossa CGMossa force-pushed the feat/ui-cli-help branch from 8ecbd49 to cb54b77 Compare May 16, 2026 11:19
@CGMossa
Copy link
Copy Markdown
Contributor Author

CGMossa commented May 17, 2026

The original PR post has changed substantially, and the conversation here is not on the latest proposal. Merging, as it is innocuous as is.

@CGMossa CGMossa merged commit c633a0f into main May 17, 2026
1 check passed
@CGMossa CGMossa deleted the feat/ui-cli-help branch May 17, 2026 08:57
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.

2 participants