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

Issues/21 #26

Merged
merged 3 commits into from Mar 13, 2024
Merged

Issues/21 #26

merged 3 commits into from Mar 13, 2024

Conversation

disog
Copy link
Contributor

@disog disog commented Mar 13, 2024

A new omitStyles function was added in packages/tsargp/lib/styles.ts to check the necessary environment variables:

  • FORCE_COLOR to emit styles even when the output is being redirected
  • NO_COLOR to omit styles if FORCE_COLOR is not set
  • TERM=dumb to omit styles, if none of the previous variables was set

Note that, if the terminal width is zero (or undefined), and FORCE_COLOR is not set, styles will be omitted regardless of the values of the other two variables.

A new parameter was added to the wrap method of both ErrorMessage and HelpMessage classes:

  • emitStyles - boolean - true if styles should be emitted - defaults to !omitStyles(width)

Likewise for the wrapToWidth method of the TerminalString class, except that it is required in this case.

Note

The getAddMessage function was removed from .changeset/commit.cjs because the changeset add command was ignoring git commit failures, which might happen in the pre-commit hook. As a result, contributors will now have to commit the changeset file manually.

Closes #21

@disog disog requested a review from a team as a code owner March 13, 2024 18:55
Copy link

changeset-bot bot commented Mar 13, 2024

🦋 Changeset detected

Latest commit: 0fe4242

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
tsargp Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

packages/tsargp/test/styles.spec.ts Outdated Show resolved Hide resolved
packages/tsargp/test/styles.spec.ts Outdated Show resolved Hide resolved
packages/tsargp/test/styles.spec.ts Outdated Show resolved Hide resolved
packages/tsargp/lib/styles.ts Outdated Show resolved Hide resolved
packages/tsargp/lib/styles.ts Outdated Show resolved Hide resolved
Copy link
Contributor Author

@disog disog left a comment

Choose a reason for hiding this comment

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

LGTM

@disog disog merged commit e039ba2 into main Mar 13, 2024
3 checks passed
@disog disog deleted the issues/21 branch March 13, 2024 21:08
@disog disog mentioned this pull request Mar 13, 2024
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.

Should detect the NO_COLOR environment variable
1 participant