Skip to content

Commit f91333d

Browse files
Update command line interface (#220)
## What is the goal of this PR? We update the CLI options to use the more distinct `--core` flag for connecting to the core server, mirroring `--enterprise`. Connecting to TypeDB Core: ``` typedb console --core=<address> ``` Connecting to TypeDB Enterprise (unchanged): ``` typedb console --enterprise=<address> --username=<username> --password --tls-enabled ``` See typedb/typedb#6942 for full details. We also improve the UX of the windows version of the entry point. Console no longer opens in a new window, but rather begins the REPL in the current command line window.
1 parent 9d756fb commit f91333d

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ cd <your_typedb_console_dir>/
1919

2020
You can provide several command arguments when running console in the terminal.
2121

22-
- `--server=<address>` : TypeDB server address to which the console will connect to.
22+
- `--core=<address>` : TypeDB server address to which the console will connect to.
2323
- `--enterprise=<address>` : TypeDB Enterprise server address to which the console will connect to.
2424
- `--username=<username>` : TypeDB Enterprise username to connect with.
2525
- `--password` : Interactively enter password to connect to TypeDB Enterprise with.

TypeDBConsole.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,8 @@ private boolean runInlineCommandMode(CLIOptions options, List<String> inlineComm
457457
private TypeDBDriver createTypeDBDriver(CLIOptions options) {
458458
TypeDBDriver driver = null;
459459
try {
460-
if (options.server() != null) {
461-
driver = TypeDB.coreDriver(options.server());
460+
if (options.core() != null) {
461+
driver = TypeDB.coreDriver(options.core());
462462
} else {
463463
String optEnterprise = options.enterprise();
464464
if (optEnterprise != null) {
@@ -818,11 +818,11 @@ private <T> void printCancellableResult(Stream<T> results, Consumer<T> printFn)
818818
private static class CLIOptions implements Runnable {
819819

820820
@CommandLine.Option(
821-
names = {"--server"},
822-
description = "TypeDB address to which Console will connect to"
821+
names = {"--core"},
822+
description = "TypeDB Core address to which Console will connect to"
823823
)
824824
private @Nullable
825-
String server;
825+
String core;
826826

827827
@CommandLine.Option(
828828
names = {"--enterprise"},
@@ -884,8 +884,8 @@ public void run() {
884884
}
885885

886886
private void validateOptions() {
887-
if (server != null && enterprise != null) {
888-
throw new CommandLine.ParameterException(spec.commandLine(), "Either '--server' or '--enterprise' must be provided, but not both.");
887+
if (core != null && enterprise != null) {
888+
throw new CommandLine.ParameterException(spec.commandLine(), "Either '--core' or '--enterprise' must be provided, but not both.");
889889
} else {
890890
if (enterprise != null) validateEnterpriseOptions();
891891
else validateServerOptions();
@@ -913,8 +913,8 @@ private void validateEnterpriseOptions() {
913913
}
914914

915915
@Nullable
916-
private String server() {
917-
return server;
916+
private String core() {
917+
return core;
918918
}
919919

920920
@Nullable

dependencies/vaticle/repositories.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def vaticle_typedb_common():
2828
git_repository(
2929
name = "vaticle_typedb_common",
3030
remote = "https://github.com/vaticle/typedb-common",
31-
tag = "2.25.3", # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_typedb_common
31+
commit = "a338f2aec875f9e1a2578e803d0e7f2a92c6623d", # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_typedb_common
3232
)
3333

3434
def vaticle_typedb_driver():

test/assembly/AssemblyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void test_console_command() throws IOException, InterruptedException, Tim
3434
TypeDBCoreRunner coreRunner = new TypeDBCoreRunner();
3535
try {
3636
coreRunner.start();
37-
int status = consoleRunner.run("--server", coreRunner.address(), "--command", "database create assembly-test-db");
37+
int status = consoleRunner.run("--core", coreRunner.address(), "--command", "database create assembly-test-db");
3838
if (status != 0) {
3939
fail("Console command returned non-zero exit status: " + status);
4040
}

0 commit comments

Comments
 (0)