Skip to content

Commit

Permalink
Fixed runtime argument parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Jun 27, 2024
1 parent 9075330 commit f3af46d
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/main/java/xyz/uartix/util/RuntimeArgumentParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package xyz.uartix.util;

import java.net.URISyntaxException;
import java.nio.file.Paths;
import java.util.List;

import net.sourceforge.argparse4j.ArgumentParsers;
Expand All @@ -41,16 +39,8 @@ public boolean parse() {
ArgumentParser parser = null;
try {
List<String> serialPorts = Uart.listSerialPorts();
String jarName = Paths.get(this.getClass()
.getProtectionDomain()
.getCodeSource()
.getLocation()
.toURI()
.getPath()
).getFileName()
.toString();

parser = ArgumentParsers.newFor(jarName).build()
parser = ArgumentParsers.newFor("uartix").build()
.defaultHelp(true)
.description("Execute Uartix script files.");

Expand All @@ -75,10 +65,6 @@ public boolean parse() {
parser.handleError(e);
return false;
}
catch(URISyntaxException e) {
System.out.println("\u001b[31mInternal Error\u001b[0m: " + e.getMessage());
return false;
}

return true;
}
Expand Down

0 comments on commit f3af46d

Please sign in to comment.