public final class CliParser extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CliParser.ARGUMENT
A collection of static final strings that represent the possible command
line arguments.
|
| Constructor and Description |
|---|
CliParser(Settings settings)
Constructs a new CLI Parser object with the configured settings.
|
| Modifier and Type | Method and Description |
|---|---|
Boolean |
getBooleanArgument(String argument)
Returns the argument boolean value.
|
String |
getDatabaseDriverName()
Returns the database driver name if specified; otherwise null is
returned.
|
String[] |
getExcludeList()
Retrieves the list of excluded file patterns specified by the 'exclude'
argument.
|
float |
getFailOnCVSS()
Returns the CVSS value to fail on.
|
File |
getFileArgument(String option)
Returns the argument value for the given option.
|
float |
getFloatArgument(String option,
float defaultValue)
Returns the float argument for the given option.
|
Integer |
getIntegerValue(String argument)
Returns the argument value.
|
String |
getProjectName()
Returns the application name specified on the command line.
|
String |
getReportDirectory()
Returns the directory to write the reports to specified on the command
line.
|
String[] |
getReportFormat()
Returns the output format specified on the command line.
|
String[] |
getRetireJsFilters()
Retrieves the list of retire JS content filters used to exclude JS files
by content.
|
String[] |
getScanFiles()
Retrieves the file command line parameter(s) specified for the 'scan'
argument.
|
String |
getStringArgument(String option)
Returns the argument value for the given option.
|
String |
getStringArgument(String option,
String key)
Returns the argument value for the given option.
|
String[] |
getStringArguments(String option)
Returns the argument value for the given option.
|
int |
getSymLinkDepth()
Returns the symbolic link depth (how deeply symbolic links will be
followed).
|
boolean |
hasDisableOption(String argument,
String setting)
Utility method to determine if one of the disable options has been set.
|
Boolean |
hasOption(String option)
Checks if the option is present.
|
boolean |
isGetHelp()
Determines if the 'help' command line argument was passed in.
|
boolean |
isGetVersion()
Determines if the 'version' command line argument was passed in.
|
boolean |
isNexusUsesProxy()
Returns true if the Nexus Analyzer should use the configured proxy to
connect to Nexus; otherwise false is returned.
|
boolean |
isNodeAuditDisabled()
Returns true if the disableNodeAudit command line argument was specified.
|
boolean |
isPurge()
Checks if the purge NVD flag has been set.
|
Boolean |
isRetireJsFilterNonVulnerable()
Returns whether or not the retireJS analyzer should exclude
non-vulnerable JS from the report.
|
boolean |
isRunScan()
Determines if the 'scan' command line argument was passed in.
|
boolean |
isUpdateOnly()
Checks if the update only flag has been set.
|
boolean |
isYarnAuditDisabled()
Returns true if the disableYarnAudit command line argument was specified.
|
void |
parse(String[] args)
Parses the arguments passed in and captures the results for later use.
|
void |
printHelp()
Displays the command line help message to the standard output.
|
void |
printVersionInfo()
Prints the manifest information to standard output.
|
public CliParser(Settings settings)
settings - the configured settingspublic void parse(String[] args) throws FileNotFoundException, org.apache.commons.cli.ParseException
args - the command line argumentsFileNotFoundException - is thrown when a 'file' argument does not
point to a file that exists.org.apache.commons.cli.ParseException - is thrown when a Parse Exception occurs.public boolean isGetVersion()
public boolean isGetHelp()
public boolean isRunScan()
public int getSymLinkDepth()
public boolean hasDisableOption(String argument, String setting)
Example given `--disableArchive` on the command line would cause this method to return true for the disable archive setting.
argument - the command line argumentsetting - the corresponding settings keypublic boolean isNodeAuditDisabled()
public boolean isYarnAuditDisabled()
public boolean isNexusUsesProxy()
public Boolean getBooleanArgument(String argument)
argument - the argumentpublic String getStringArgument(String option)
option - the optionpublic String getStringArgument(String option, String key)
option - the optionkey - the dependency-check settings key for the option.public String[] getStringArguments(String option)
option - the optionpublic File getFileArgument(String option)
option - the optionpublic void printHelp()
public String[] getScanFiles()
public String[] getExcludeList()
public String[] getRetireJsFilters()
public Boolean isRetireJsFilterNonVulnerable()
true if non-vulnerable JS should be filtered in the
RetireJS Analyzer; otherwise nullpublic String getReportDirectory()
public String[] getReportFormat()
public String getProjectName()
public void printVersionInfo()
Prints the manifest information to standard output.
public boolean isUpdateOnly()
true if the update only flag has been set; otherwise
false.public boolean isPurge()
true if the purge nvd flag has been set; otherwise
false.public String getDatabaseDriverName()
public Integer getIntegerValue(String argument)
argument - the argumentpublic Boolean hasOption(String option)
true; otherwise false.option - the option to checktrue if auto-update is allowed; otherwise
nullpublic float getFailOnCVSS()
public float getFloatArgument(String option, float defaultValue)
option - the optiondefaultValue - the value if the option is not presentCopyright © 2012–2021 OWASP. All rights reserved.