Skip to content

Commit

Permalink
added macro to read Optional Args
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanho committed Nov 14, 2024
1 parent 383032b commit 682c08f
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/ucar/unidata/idv/ArgsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@

import java.rmi.RemoteException;

import java.util.ArrayList;

import java.util.Date;
import java.util.Hashtable;
import java.util.List;
import java.util.Properties;
import java.util.*;


/**
Expand Down Expand Up @@ -349,7 +344,8 @@ public class ArgsManager extends IdvManager {
/** Holds the set files arguments */
protected List fileMappingFiles = new ArrayList();


/** Holds the optional arguments of ISL file */
protected Hashtable islOptionalArgs = new Hashtable<>(50);
/**
* Create the manager with the given idv and command line arguments.
* This just sets some state, it does not yet parse the arguments.
Expand All @@ -369,6 +365,14 @@ public ArgsManager(IntegratedDataViewer idv, String[] args) {
//TODO: commandLineArgs = preprocessArgs(args);
}

/**
* Get the very original command line arguments. The ones before we pre-process them.
*
* @return The command line args
*/
public Hashtable getOptionalArgs() {
return islOptionalArgs;
}

/**
* Get the very original command line arguments. The ones before we pre-process them.
Expand Down Expand Up @@ -947,6 +951,16 @@ public void run() {
if ( !islInteractive) {
setIsOffScreen(true);
}
if(args.length > 1){
while ((idx +1)< args.length) {
String argStr = args[idx++];
String argValue = args[idx++];
if(argStr.startsWith("-")) {
String idd = argStr.substring(1);
islOptionalArgs.put(idd, argValue);
}
}
}
} else if (isXidvFile(arg)) {
argXidvFiles.add(arg);
} else if (isZidvFile(arg)) {
Expand Down

0 comments on commit 682c08f

Please sign in to comment.