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

Clean up custom console output with utils #712

Merged
merged 2 commits into from
Jun 28, 2022

Conversation

cassaundra
Copy link
Contributor

@cassaundra cassaundra commented Jun 22, 2022

Use utility functions to simplify styling and make the existing styling and indentation more consistent.

A few instances of manual styling remain:

  • In the deprecation messages in set_version.rs and upgrade.rs (these could use an aesthetic pass too though, since they look out of place).
  • In the feature activation list of set_version.
  • In cargo add, per review discussion.

This also serves as a step towards #682, as these utilities functions are similar in form to Cargo's shell output.

Copy link
Collaborator

@epage epage left a comment

Choose a reason for hiding this comment

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

Thanks! I hadn't even considered aligning the printing

tests/cmd/upgrade/dry_run.toml Outdated Show resolved Hide resolved
src/util.rs Outdated Show resolved Hide resolved
src/util.rs Outdated Show resolved Hide resolved
src/util.rs Outdated Show resolved Hide resolved
src/bin/add/add.rs Outdated Show resolved Hide resolved
src/bin/add/add.rs Outdated Show resolved Hide resolved
src/util.rs Outdated Show resolved Hide resolved
@cassaundra
Copy link
Contributor Author

cassaundra commented Jun 22, 2022

Okay! I wasn't originally planning on directly mimicking Cargo's internal implementation of the shell utilities, but seeing the merits of that, I renamed the functions as requested. I also added a justified parameter, and applied that to shell_warn.

Per your request, I also reverted all changes made to cargo add. It turns out the only instance of an uppercase message is inside cargo add, for what it's worth:

unrecognized_features_message(&format!(
"Unrecognized features: {:?}",
unknown_features
))?;

@cassaundra cassaundra mentioned this pull request Jun 22, 2022
14 tasks
Copy link
Collaborator

@epage epage left a comment

Choose a reason for hiding this comment

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

Last things

src/bin/add/add.rs Outdated Show resolved Hide resolved
src/bin/add/add.rs Outdated Show resolved Hide resolved
Fixes an off-by-one relative to the rest of the project's output formatting.
@cassaundra
Copy link
Contributor Author

Okay! I've cleaned up the git history quite a bit. Should be good to merge.

@epage
Copy link
Collaborator

epage commented Jun 28, 2022

Thanks!

@epage epage merged commit ef10b5b into killercup:master Jun 28, 2022
@cassaundra cassaundra deleted the print-util branch June 28, 2022 03:33
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