Skip to content

Commit

Permalink
Added a placeholder for "mdns-scan" command (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed Aug 29, 2024
1 parent b4c9c41 commit 8feb06d
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class HccCLI implements CommandLineRunner {
private static final Logger logger = LogManager.getLogger(HccCLI.class);

private static final String COMMAND_GET_META = "get-meta";
private static final String COMMAND_MDNS_SCAN = "mdns-scan";

public abstract class CommandBase {

Expand All @@ -27,6 +28,12 @@ public class CommandGetMeta extends CommandBase {

}

public class CommandMdnsScan {

@Parameter(names = { "--timeout" }, description = "Scan timeout in seconds")
int timeout = 1;
}

public static void main(String[] args) {

var builder = new SpringApplicationBuilder(HccCLI.class);
Expand All @@ -42,9 +49,12 @@ public static void main(String[] args) {
public void run(String... args) throws Exception {

var commandGetMeta = new CommandGetMeta();
var commandMdnsScan = new CommandMdnsScan();

var jc = JCommander
.newBuilder()
.addCommand(COMMAND_GET_META, commandGetMeta)
.addCommand(COMMAND_MDNS_SCAN, commandMdnsScan)
.build();

try {
Expand All @@ -58,6 +68,7 @@ public void run(String... args) throws Exception {
switch (jc.getParsedCommand()) {

case COMMAND_GET_META -> getMeta(commandGetMeta.url);
case COMMAND_MDNS_SCAN -> mdnsScan();

}

Expand All @@ -81,6 +92,15 @@ private void getMeta(String url) {
}
}

private void mdnsScan() {
ThreadContext.push("mdnsScan");
try {
throw new UnsupportedOperationException("Stay tuned");
} finally {
ThreadContext.pop();
}
}

private static void terminate(JCommander jc, String message, Throwable t) {

logger.fatal(message, t);
Expand Down

0 comments on commit 8feb06d

Please sign in to comment.