Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit d6cafbc

Browse files
committed
Enable changing server address when logged out
1 parent 00b74b6 commit d6cafbc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/main/java/fi/helsinki/cs/tmc/cli/command/ConfigCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,14 @@ public void run(CliContext context, CommandLine args) {
176176
boolean get = args.hasOption("g");
177177
boolean listing = args.hasOption("l");
178178
boolean delete = args.hasOption("d");
179+
boolean update = !get && !listing && !delete;
179180
this.quiet = args.hasOption("q");
180181

181182
String[] arguments = args.getArgs();
182183
arguments = Arrays.stream(arguments).filter(o -> !o.trim().isEmpty()).toArray(String[]::new);
183184
this.properties = context.getProperties();
184185

185-
if (!this.context.checkIsLoggedIn(false, true)) {
186+
if (!update && !this.context.checkIsLoggedIn(false, true)) {
186187
return;
187188
}
188189

src/main/java/fi/helsinki/cs/tmc/cli/command/LoginCommand.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ public void run(CliContext context, CommandLine args) {
7777

7878
public boolean login(CliContext ctx, CommandLine args, Optional<String> serverAddress) {
7979
Io io = ctx.getIo();
80+
if (serverAddress.isPresent()) {
81+
io.println("Logging in to " + serverAddress.get());
82+
}
8083
username = getLoginInfo(args, username, "u", "username: ", io);
8184
password = getLoginInfo(args, null, "p", "password: ", io);
8285

0 commit comments

Comments
 (0)