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

Improvement: Don't emit control codes to STDOUT for non-colored output. #229

Merged
merged 8 commits into from
Feb 9, 2023

Conversation

DaveMcEwan
Copy link
Contributor

  • Update sv-parser to v0.13.0, avoiding yanked v0.12.3
  • Update clap from v3.1.18 to v3.2.* (currently v3.2.23) which is the minimum version to get ValueEnum.
    The authors of clap appear to have stopped releasing multiple versions per day for v3.x!
  • Change --dump-filelist from bool to ValueEnum.
    • Previous behavior of not using the flag is equivalent to --dump-filelist=no, or just not using
      the flag (backwards compatible).
    • Previous behavior of using the flag is equivalent to --dump-filelist=yaml.
      That's a breaking change to the flag.
      The output is functionally equivalent (except for the removed control codes).
    • Possible values files, incdirs, defines give new modes where output is intended to be
      processed by shell scripts (see Feature: Add some pre-configured and explained "rulesets" (TOML files) with wrapper scripts. #224).
      One line per file/incdir/define, without control codes.
  • Changed printer.write() so that it doesn't require a color, and printer.print,printer.println to
    avoid control codes for reset/clearing the terminal.
  • Added unittests for new modes of --dump-filelist, but they can't check for control codes.

Breaking API changes mean 0.12.3 is yanked.
The change is spelling of Assetion -> Assertion
Minimal bump to get ValueEnum, intended for use with `--dump-filelist`.
https://docs.rs/clap/latest/clap/trait.ValueEnum.html
- No: Default does not dump anything.
  Equivalent to false in previous behaviour.
- Yaml: Dump in YAML format showing how incdirs and defines change as child
  filelists are processed.
  Equivalent to true in previous behaviour.
- Files: Dump only the final list of files, one per line, unquoted.
  Intended to be suitable for shell processing.
  This is the main motivation for this branch (see dalance#224).
- Incdirs: Dump only the final list of include directories, similar to Files.
- Defines: Dump only the final list of defines to be set *before* any
  preprocessing, similar to Files.
- `printer.print()`, `printer.println()` don't use Color::Reset, but all
  other `printer.*()` functions behave as before.
- Directly addresses dalance#226, and indirectly addresses dalance#224.
This highlights the bug in using the Debug trait, now fixed on this branch.
@dalance dalance merged commit c4ccc19 into dalance:master Feb 9, 2023
@DaveMcEwan DaveMcEwan deleted the improvement226 branch February 9, 2023 11:31
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