Skip to content

Commit

Permalink
Merge pull request #853 from NASA-PDS/251203_lddtool_h_overwrites
Browse files Browse the repository at this point in the history
Fix `lddtool --help` output
  • Loading branch information
jordanpadams authored Dec 10, 2024
2 parents c4a7601 + 75c985c commit fc08ef4
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,15 @@ public static void main(String[] args) throws Throwable {
*/
public static void run(String[] args) throws Throwable {
init();

// get the command line arguments using argparse4j
Namespace argparse4jNamespace = getArgumentParserNamespace(args);

// get the command line arguments using argparse4j
Namespace argparse4jNamespace = null;
try {
argparse4jNamespace = getArgumentParserNamespace(args);
} catch (Throwable e) {
return;
}

String nameSpaceDataDirPath = null;

// process first set of arguments
Expand Down Expand Up @@ -1142,7 +1148,7 @@ static void setRegistryAttrFlag() {
registryAttr.add("version_id");
}

static Namespace getArgumentParserNamespace(String args[]) throws ArgumentParserException {
static Namespace getArgumentParserNamespace(String args[]) throws Throwable {
parser = ArgumentParsers.newFor("LDDTool").build().defaultHelp(true).version(LDDToolVersionId)
.description("LDDTool process control:");

Expand Down Expand Up @@ -1226,13 +1232,12 @@ static Namespace getArgumentParserNamespace(String args[]) throws ArgumentParser
try {
namespace = parser.parseArgs(args);
} catch (HelpScreenException e) {
System.out.println(">> INFO Exit(0)");
parser.printHelp();
// the library prints the help message internally so no need for parser.printHelp()
throw e;
} catch (ArgumentParserException e) {
System.out.println(">> ERROR Invalid argument list");
lMessageFatalErrorCount++;
parser.printHelp();
System.out.println(">> INFO Exit(1)");
throw e;
}
return namespace;
Expand Down

0 comments on commit fc08ef4

Please sign in to comment.