Commit 257818e
authored
Add color by default to printing the text format (#1596)
* Add color by default to printing the text format
This commit builds on #1593 to provide colorized output of `wasm-tools
print`, or any other subcommand that prints the text format, by default.
Color settings are controlled on the CLI with `--color` and are
automatically disabled in various situations such as outputting to a
file or when an output pipe is used.
Internally `wasmprinter` has grown a new trait, `Print`, through which
all output goes through. There are adapters for this trait for
`std::fmt::Write`, `std::io::Write`, and `termcolor::WriteColor`. Custom
trait implementations are also possible if necessary.
While here I've additionally moved custom custom section printing to the
trait itself instead of being part of the printer configuration as it
felt more appropriate as a per-sink configuration.
* Improve float colors (use comment colors for comments)1 parent 7003116 commit 257818e
File tree
19 files changed
+457
-221
lines changed- crates/wasmprinter
- src
- tests
- src
- bin/wasm-tools
19 files changed
+457
-221
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | | - | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
0 commit comments