-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: Disable client console highlight by default #9013
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @comphead! I should have done this myself. I guess depending on the terminal setup, the color scheme can be either smooth or not.
@@ -136,6 +136,9 @@ struct Args { | |||
default_value = "40" | |||
)] | |||
maxrows: MaxRows, | |||
|
|||
#[clap(long, help = "Enables console syntax highlighting")] | |||
color: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe call this syntax_highlighting
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another potential option might be to follow the duckdb
lead and call it ascii
output mode 🤔 (when there is no color)
andrewlamb@Andrews-MacBook-Pro:~/Software/influxdb_iox$ duckdb --help
Usage: duckdb [OPTIONS] FILENAME [SQL]
FILENAME is the name of an DuckDB database. A new database is created
if the file does not previously exist.
OPTIONS include:
-append append the database to the end of the file
-ascii set output mode to 'ascii'
-bail stop after hitting an error
-batch force batch I/O
-box set output mode to 'box'
-column set output mode to 'column'
-cmd COMMAND run "COMMAND" before reading stdin
-c COMMAND run "COMMAND" and exit
-csv set output mode to 'csv'
-echo print commands before execution
-init FILENAME read/process named file
-[no]header turn headers on or off
-help show this message
-html set output mode to HTML
-interactive force interactive I/O
-json set output mode to 'json'
-line set output mode to 'line'
-list set output mode to 'list'
-markdown set output mode to 'markdown'
-newline SEP set output row separator. Default: '\n'
-nofollow refuse to open symbolic links to database files
-no-stdin exit after processing options instead of reading stdin
-nullvalue TEXT set text string for NULL values. Default ''
-quote set output mode to 'quote'
-readonly open the database read-only
-s COMMAND run "COMMAND" and exit
-separator SEP set output column separator. Default: '|'
-stats print memory stats before each finalize
-table set output mode to 'table'
-unsigned allow loading of unsigned extensions
-version show DuckDB version
datafusion-cli/src/highlighter.rs
Outdated
Self { dialect } | ||
} | ||
} | ||
|
||
pub struct NoSyntaxSyntaxHighlighter {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NoSyntaxHighlighter
(Syntax
is duplicate)?
Thanks @trungda. I really love we started the coloring/customizing, appearance is what people buy :) and now we have all the code inside, and both users and developers can now experiment and come up with solution. It can even a factory of solutions, different schemas, etc @alamb would you mind sharing your opinion? |
I think this sounds like a great idea. I would suggest filing a ticket explaining what is desired (namely come up with a color scheme that is pleasing, maybe even enough to enable by default) which may also help attract additional contributions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM -- thanks @comphead -- I do think it would be great to get to the point where this could be enabled by default for colorized terminals
@@ -136,6 +136,9 @@ struct Args { | |||
default_value = "40" | |||
)] | |||
maxrows: MaxRows, | |||
|
|||
#[clap(long, help = "Enables console syntax highlighting")] | |||
color: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another potential option might be to follow the duckdb
lead and call it ascii
output mode 🤔 (when there is no color)
andrewlamb@Andrews-MacBook-Pro:~/Software/influxdb_iox$ duckdb --help
Usage: duckdb [OPTIONS] FILENAME [SQL]
FILENAME is the name of an DuckDB database. A new database is created
if the file does not previously exist.
OPTIONS include:
-append append the database to the end of the file
-ascii set output mode to 'ascii'
-bail stop after hitting an error
-batch force batch I/O
-box set output mode to 'box'
-column set output mode to 'column'
-cmd COMMAND run "COMMAND" before reading stdin
-c COMMAND run "COMMAND" and exit
-csv set output mode to 'csv'
-echo print commands before execution
-init FILENAME read/process named file
-[no]header turn headers on or off
-help show this message
-html set output mode to HTML
-interactive force interactive I/O
-json set output mode to 'json'
-line set output mode to 'line'
-list set output mode to 'list'
-markdown set output mode to 'markdown'
-newline SEP set output row separator. Default: '\n'
-nofollow refuse to open symbolic links to database files
-no-stdin exit after processing options instead of reading stdin
-nullvalue TEXT set text string for NULL values. Default ''
-quote set output mode to 'quote'
-readonly open the database read-only
-s COMMAND run "COMMAND" and exit
-separator SEP set output column separator. Default: '|'
-stats print memory stats before each finalize
-table set output mode to 'table'
-unsigned allow loading of unsigned extensions
-version show DuckDB version
I also like duckdb style its not overcolored and easy to read, but yes we can implement now different highlighters. |
Which issue does this PR close?
Closes #.
Rationale for this change
The syntax highlight has been introduced in #8918. Thanks again @trungda
Some users is not comfortable with new syntax highlight, so the PR makes it optional. The user can enable coloring providing color flag
datafusion-cli --color
For now the syntax highlight put as disabled by default, my humble vision its a little bit experimental and we may want to improve the color schema to be more smooth.
What changes are included in this PR?
introduced NoColor strategy and the color provider gets enabled by the
--color
flagAre these changes tested?
Yes, manually
Are there any user-facing changes?
No