-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. Closes #21
- Loading branch information
Showing
7 changed files
with
96 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'tsargp': patch | ||
--- | ||
|
||
You can now set the `NO_COLOR` environment variable to _omit_ styles from error and help messages. | ||
You can also set `FORCE_COLOR` to _emit_ styles even when the output is being redirected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters