-
Notifications
You must be signed in to change notification settings - Fork 136
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
New Java based Nessie CLI tool + REPL #8348
Conversation
716d5fa
to
68895a7
Compare
43483c4
to
9b84ff3
Compare
0fef268
to
b492737
Compare
34dec4e
to
e723375
Compare
437427d
to
2f7319b
Compare
private Reference currentReference; | ||
private Terminal terminal; | ||
|
||
public Integer exitWithCode() { |
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.
The method name suggests that System.exit()
is going to be called. How about just getExitCode/setExitCode
?
cli/cli/src/main/java/org/projectnessie/nessie/cli/cli/NessieCliImpl.java
Show resolved
Hide resolved
cli/cli/src/main/java/org/projectnessie/nessie/cli/cli/NessieCliHighlighter.java
Show resolved
Hide resolved
CHANGELOG.md
Outdated
@@ -8,6 +8,8 @@ as necessary. Empty sections will not end in the release notes. | |||
|
|||
### Highlights | |||
|
|||
- New Nessie CLI tool + REPL |
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 elaborate a bit.
private static final AttributedStyle STYLE_COMMAND = DEFAULT.foreground(0, 128, 0); | ||
private static final AttributedStyle STYLE_REF_TYPE = DEFAULT.foreground(0, 128, 128); | ||
private static final AttributedStyle STYLE_KEYWORD = DEFAULT.foreground(128, 128, 0); | ||
private static final AttributedStyle STYLE_INVALID = DEFAULT.foreground(168, 0, 0); | ||
private static final AttributedStyle STYLE_LITERAL = DEFAULT.bold().italic(); |
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.
Easier to grasp:
private static final AttributedStyle STYLE_COMMAND = DEFAULT.foreground(GREEN);
private static final AttributedStyle STYLE_REF_TYPE = DEFAULT.foreground(CYAN);
private static final AttributedStyle STYLE_KEYWORD = DEFAULT.foreground(YELLOW);
private static final AttributedStyle STYLE_INVALID = DEFAULT.foreground(RED);
cli/cli/src/main/java/org/projectnessie/nessie/cli/cli/NessieCliHighlighter.java
Show resolved
Hide resolved
|
||
// There's no easy, better way :( | ||
// Setting the usage-width to 100 chars so that URLs are not line-wrapped. | ||
System.setProperty("picocli.usage.width", "100"); |
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.
Have you tried commandLine.setUsageHelpAutoWidth(true);
?
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.
Hm - I'd like to keep it at 100 fixed for now, because the docs-generator uses "--help" as well - and I don't know how that would look like in CI.
5ced6b0
to
446ce3b
Compare
Features & functionalities: * SQL-ish syntax. * REPL. * Built-in online `HELP` command (and `HELP <command>` command ;), that also shows the commands' syntaxes in the online help. The same information is also published on the projectnessie.org site. * Auto-completion of commands, keywords and reference names (use TAB). * Syntax highlighting. * Paging of long results - showing a lot of content keys or a long commit log just works like `less` on your Linux or macOS box. * Command history, persisted in your home directory (can be turned off). * "Just" run a one or more Nessie REPL commands - pass those as arguments on the command line or as a script. * Supports all authentication mechanisms that the Nessie Java supports, including all OAuth2 flows. * Relatively small, currently just ~14.5MB. * Available commands to manage branches and tags, drop tables and views, manage namespaces, list and show tables & views, merge and help. * Contains interactive functionality that content-generator tool and pynessie provide, but not potentially dangerous operations. It's not based on Quarkus, but "plain" Java 11, allows a smaller uber-jar of 14.5 instead of 18.5MB, also improves startup time a bit. Also included in this PR: * Updates to the web site, syntax docs generated from Grammar. * Same help texts used for online help + web site. * Blog post. Uses congocc Grammar and parser/lexer, really quick parsing and no runtime dependencies required. congocc also allows relatively(!) easy integration of command line completion and syntax highlighting. To try the Nessie CLI tool: `./gradlew :nessie-cli:jar && java -jar cli/cli/build/libs/nessie-cli-0.80.1-SNAPSHOT.jar`
* Replace `IN` with `ON` (`IN` is used to reference a catalog in Nessie Spark SQL extensions) * Enhance `ON` with optional `BRANCH` or `TAG` * Enhance `AT` with optional `TIMESTAMP` or `COMMIT` * Rename `TimestampOrHash` to `TimestampOrCommit`
Reverted a couple of updates to the web-site in the last added commit, as those would break CI and also confuse users. |
Features & functionalities:
HELP
command (andHELP <command>
command ;), that also shows the commands' syntaxes in the online help. The same information is also published on the projectnessie.org site.less
on your Linux or macOS box.It's not based on Quarkus, but "plain" Java 11, allows a smaller uber-jar of 14.5 instead of 18.5MB, also improves startup time a bit.
Also included in this PR:
Uses congocc Grammar and parser/lexer, really quick parsing and no runtime dependencies required. congocc also allows relatively(!) easy integration of command line completion and syntax highlighting.
To try the Nessie CLI tool:
./gradlew :nessie-cli:jar && java -jar cli/cli/build/libs/nessie-cli-0.80.1-SNAPSHOT.jar