Originally created by @jstrachan on GitHub (Apr 12, 2024).
I was watching Viktor's review of pkl and the lack of syntax highlighting shouted me when running pkl eval on the command line.
I'm so used to color based syntax highlighting in all languages it really shouts to me when there's no color
I wonder if we should have an optional colour option to pkl eval that could use ANSI colours to make the output look nicer?
Originally created by @jstrachan on GitHub (Apr 12, 2024).
I was watching Viktor's [review of pkl](https://www.youtube.com/watch?v=Nm1ioWPRRVQ) and the lack of syntax highlighting shouted me when running `pkl eval` on the command line.
I'm so used to color based syntax highlighting in all languages it really shouts to me when there's no color
I wonder if we should have an optional colour option to `pkl eval` that could use ANSI colours to make the output look nicer?
I use bat whenever I need better syntax highlighting in my output. E.g. pkl eval foo.pkl | bat -l yaml.
The --format flag can be ignored by a Pkl program by setting it directly in the module, so it's not really clear how we can add proper syntax highlighting here.
It'd be good to colorize the output in case of errors, though.
@bioball commented on GitHub (Apr 12, 2024):
I use [bat](https://github.com/sharkdp/bat) whenever I need better syntax highlighting in my output. E.g. `pkl eval foo.pkl | bat -l yaml`.
The `--format` flag can be ignored by a Pkl program by setting it directly [in the module](https://pkl-lang.org/main/current/language-reference/index.html#in-language), so it's not really clear how we can add proper syntax highlighting here.
It'd be good to colorize the output in case of errors, though.
it's not really clear how we can add proper syntax highlighting here.
Would it be possible to support pluggable highlighters that are told which renderer is used?
@odenix commented on GitHub (Apr 12, 2024):
> it's not really clear how we can add proper syntax highlighting here.
Would it be possible to support pluggable highlighters that are told which renderer is used?
Might be doable to have the renderers themselves add ANSI escape sequences.
Would need to somehow know whether the CLI command is being run in interactive mode or not.
Generally CLI commands should strip colors if run in a non-interactive context (e.g. pkl eval foo.pkl > output.yaml should not include ANSI escape codes). And it's common to have a --color flag that overrides the default behavior (e.g. --color=always to keep color regardless of interactive mode).
@bioball commented on GitHub (Apr 12, 2024):
Might be doable to have the renderers themselves add ANSI escape sequences.
Would need to somehow know whether the CLI command is being run in interactive mode or not.
Generally CLI commands should strip colors if run in a non-interactive context (e.g. `pkl eval foo.pkl > output.yaml` should not include ANSI escape codes). And it's common to have a `--color` flag that overrides the default behavior (e.g. `--color=always` to keep color regardless of interactive mode).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @jstrachan on GitHub (Apr 12, 2024).
I was watching Viktor's review of pkl and the lack of syntax highlighting shouted me when running
pkl evalon the command line.I'm so used to color based syntax highlighting in all languages it really shouts to me when there's no color
I wonder if we should have an optional colour option to
pkl evalthat could use ANSI colours to make the output look nicer?@bioball commented on GitHub (Apr 12, 2024):
I use bat whenever I need better syntax highlighting in my output. E.g.
pkl eval foo.pkl | bat -l yaml.The
--formatflag can be ignored by a Pkl program by setting it directly in the module, so it's not really clear how we can add proper syntax highlighting here.It'd be good to colorize the output in case of errors, though.
@odenix commented on GitHub (Apr 12, 2024):
Would it be possible to support pluggable highlighters that are told which renderer is used?
@bioball commented on GitHub (Apr 12, 2024):
Might be doable to have the renderers themselves add ANSI escape sequences.
Would need to somehow know whether the CLI command is being run in interactive mode or not.
Generally CLI commands should strip colors if run in a non-interactive context (e.g.
pkl eval foo.pkl > output.yamlshould not include ANSI escape codes). And it's common to have a--colorflag that overrides the default behavior (e.g.--color=alwaysto keep color regardless of interactive mode).