-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add Markdown output format to the CLI #17697
Conversation
I also tried using the CommonMark library, but its text renderer is lacking: master...nineinchnick:trino:cli-commonmark-output |
client/trino-cli/src/main/java/io/trino/cli/MarkdownTablePrinter.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/main/java/io/trino/cli/MarkdownTablePrinter.java
Outdated
Show resolved
Hide resolved
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 % comments
65572d1
to
43ca4c8
Compare
@wendigo ready for another round |
I've tested rendering in various markdown editors and it looks good. |
client/trino-cli/src/main/java/io/trino/cli/MarkdownTablePrinter.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/main/java/io/trino/cli/MarkdownTablePrinter.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/main/java/io/trino/cli/MarkdownTablePrinter.java
Outdated
Show resolved
Hide resolved
da89953
to
7b42f2d
Compare
private final List<Align> alignments; | ||
private final Writer writer; | ||
|
||
private boolean headerOutput; |
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.
nit: headerRendered
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.
bump
client/trino-cli/src/main/java/io/trino/cli/MarkdownTablePrinter.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/main/java/io/trino/cli/MarkdownTablePrinter.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/main/java/io/trino/cli/MarkdownTablePrinter.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/main/java/io/trino/cli/MarkdownTablePrinter.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/main/java/io/trino/cli/MarkdownTablePrinter.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/test/java/io/trino/cli/TestMarkdownTablePrinter.java
Show resolved
Hide resolved
7b42f2d
to
58d9ff9
Compare
58d9ff9
to
08a4348
Compare
08a4348
to
109762e
Compare
@wendigo PTAL |
1 similar comment
@wendigo PTAL |
@nineinchnick hi! i'm back from holidays, I'll review it soon :) |
private final List<Align> alignments; | ||
private final Writer writer; | ||
|
||
private boolean headerOutput; |
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.
bump
client/trino-cli/src/test/java/io/trino/cli/TestMarkdownTablePrinter.java
Show resolved
Hide resolved
We've discussed offline to follow-up with the refactoring of the code coming from/being similiar to aligned writer. LGTM. |
Description
Add Markdown output to avoid having to use external tools like
csv2md
.Example usage:
./client/trino-cli/target/trino-cli-419-SNAPSHOT-executable.jar --output-format MARKDOWN \ --execute="select * from (values (1234567, 'some longer strin'), (123, 'aa')) as t(one, two)"
Prints:
where the default
ALIGNED
format looks like:Additional context and related issues
Release notes
(x) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: