Skip to content

feat: auto-wrap cli and add colors to the CLI#1842

Merged
CommanderStorm merged 4 commits into
maplibre:mainfrom
CommanderStorm:nicer-cli
May 21, 2025
Merged

feat: auto-wrap cli and add colors to the CLI#1842
CommanderStorm merged 4 commits into
maplibre:mainfrom
CommanderStorm:nicer-cli

Conversation

@CommanderStorm

@CommanderStorm CommanderStorm commented May 21, 2025

Copy link
Copy Markdown
Member

Motivated by transact-rs/sqlx#3849, this PR brings the same improvemnts here.

The CLIs now autowrap and have a lick of color.
image

  • code from launchbadge/sqlx is under an compatible licence

@CommanderStorm CommanderStorm requested review from Copilot, nyurik and sharkAndshark and removed request for Copilot May 21, 2025 00:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the CLI help output by enabling auto-wrapping and adding ANSI color styling via Clap's new wrap_help feature and a custom Styles constant.

  • Define HELP_STYLES with colored headers, usage, literals, and placeholders
  • Enable Clap's "wrap_help" feature and apply the styles in the Args command

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

File Description
martin/src/args/root.rs Define HELP_STYLES constant and apply it in the #[command(...)] macro
Cargo.toml Add "wrap_help" feature to the Clap dependency
Comments suppressed due to low confidence (2)

martin/src/args/root.rs:25

  • [nitpick] Rename HELP_STYLES to CLI_HELP_STYLES (or HELP_STYLE) to more clearly convey its purpose and follow constant naming clarity.
const HELP_STYLES: Styles = Styles::styled()

martin/src/args/root.rs:36

  • No tests currently cover the new auto-wrapping and color styling behavior; consider adding integration tests to verify help output wrapping and ANSI coloring.
styles = HELP_STYLES

Comment thread martin/src/args/root.rs
Comment thread Cargo.toml
@CommanderStorm CommanderStorm merged commit 57a05fe into maplibre:main May 21, 2025
20 checks passed
@CommanderStorm CommanderStorm deleted the nicer-cli branch July 10, 2025 17:03
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.

4 participants