Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Consolidate clap/shell styles #12655

Merged
merged 2 commits into from
Sep 13, 2023
Merged

refactor: Consolidate clap/shell styles #12655

merged 2 commits into from
Sep 13, 2023

Conversation

epage
Copy link
Contributor

@epage epage commented Sep 11, 2023

What does this PR try to resolve?

This is a follow up to #12578 to reduce duplication of terminal styling.

This still leaves styling in color_print::cstr!.

This is also prep for copy/pasting into clap-cargo for others to use. Another step might be to extract cargo::util::style into its own crate.

How should we test and review this PR?

We have no styling tests so this can only be verified by inspection or running the commands

Additional information

I chose anstyle for expressing these as its an API designed specifically for stable style definitions to put in public APIs.

This is a very rough pass at naming the styles with a focus on getting
something in and keeping the colors the same.
@rustbot
Copy link
Collaborator

rustbot commented Sep 11, 2023

r? @weihanglo

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-cli Area: Command-line interface, option parsing, etc. A-console-output Area: Terminal output, colors, progress bar, etc. A-filesystem Area: issues with filesystems A-interacts-with-crates.io Area: interaction with registries A-timings Area: timings Command-add Command-generate-lockfile Command-search S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 11, 2023
@epage epage changed the title refactor: Consolidate clap/shell stykles refactor: Consolidate clap/shell styles Sep 11, 2023
epage added a commit to epage/clap-cargo that referenced this pull request Sep 11, 2023
This mirrors what the API in rust-lang/cargo#12655.  I'm hoping to have
the `anstyle` consts be a public crate owned by the cargo team in the
future after which we'll refactor to re-export it.

See rust-lang/cargo#12578 for adding the style.
epage added a commit to epage/clap-cargo that referenced this pull request Sep 11, 2023
This mirrors what the API in rust-lang/cargo#12655.  I'm hoping to have
the `anstyle` consts be a public crate owned by the cargo team in the
future after which we'll refactor to re-export it.

See rust-lang/cargo#12578 for adding the style.
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Some texts are not applied correctly with bold style. Filed an upstream fix for that: rust-cli/anstyle#124.

Apart from that, it looks good :)

@epage
Copy link
Contributor Author

epage commented Sep 12, 2023

Updated with the new release of anstyle-termcolor

@epage epage mentioned this pull request Sep 13, 2023
4 tasks
@weihanglo
Copy link
Member

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Sep 13, 2023

📌 Commit 51e1058 has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 13, 2023
@bors
Copy link
Contributor

bors commented Sep 13, 2023

⌛ Testing commit 51e1058 with merge 00bf8b0...

@bors
Copy link
Contributor

bors commented Sep 13, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 00bf8b0 to master...

@bors bors merged commit 00bf8b0 into rust-lang:master Sep 13, 2023
21 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 15, 2023
Update cargo

11 commits in 2fc85d15a542bfb610aff7682073412cf635352f..d5336f813df39d476e61fc46daabb1446350660a
2023-09-09 01:49:46 +0000 to 2023-09-14 19:55:49 +0000
- fix: emit a warning for `credential-alias` shadowing (rust-lang/cargo#12671)
- refactor: fix lint errors in preparation of `[lints]` table integration (rust-lang/cargo#12669)
- Limit cargo add feature print (rust-lang/cargo#12662)
- Clippy (rust-lang/cargo#12667)
- Prerelease candidates error message (rust-lang/cargo#12659)
- Fix typos: `informations` -> `information` (rust-lang/cargo#12666)
- chore: update globset to 0.4.13 (rust-lang/cargo#12665)
- refactor: Consolidate clap/shell styles (rust-lang/cargo#12655)
- libgit2 fixed upstream (rust-lang/cargo#12657)
- Index summary enum (rust-lang/cargo#12643)
- feat(help): Add styling to help output (rust-lang/cargo#12578)

r? ghost
@ehuss ehuss added this to the 1.74.0 milestone Sep 30, 2023
@epage epage deleted the style branch November 28, 2023 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Area: Command-line interface, option parsing, etc. A-console-output Area: Terminal output, colors, progress bar, etc. A-filesystem Area: issues with filesystems A-interacts-with-crates.io Area: interaction with registries A-timings Area: timings Command-add Command-generate-lockfile Command-search S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants