public final class CliParser
extends java.lang.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 |
---|---|
java.lang.Boolean |
getBooleanArgument(java.lang.String argument)
Returns the argument boolean value.
|
java.lang.String |
getDatabaseDriverName()
Returns the database driver name if specified; otherwise null is
returned.
|
java.lang.String[] |
getExcludeList()
Retrieves the list of excluded file patterns specified by the 'exclude'
argument.
|
float |
getFailOnCVSS()
Returns the CVSS value to fail on.
|
java.io.File |
getFileArgument(java.lang.String option)
Returns the argument value for the given option.
|
float |
getFloatArgument(java.lang.String option,
float defaultValue)
Returns the float argument for the given option.
|
java.lang.Integer |
getIntegerValue(java.lang.String argument)
Returns the argument value.
|
java.lang.String |
getProjectName()
Returns the application name specified on the command line.
|
java.lang.String |
getReportDirectory()
Returns the directory to write the reports to specified on the command
line.
|
java.lang.String[] |
getReportFormat()
Returns the output format specified on the command line.
|
java.lang.String[] |
getRetireJsFilters()
Retrieves the list of retire JS content filters used to exclude JS files
by content.
|
java.lang.String[] |
getScanFiles()
Retrieves the file command line parameter(s) specified for the 'scan'
argument.
|
java.lang.String |
getStringArgument(java.lang.String option)
Returns the argument value for the given option.
|
java.lang.String |
getStringArgument(java.lang.String option,
java.lang.String key)
Returns the argument value for the given option.
|
java.lang.String[] |
getStringArguments(java.lang.String option)
Returns the argument value for the given option.
|
int |
getSymLinkDepth()
Returns the symbolic link depth (how deeply symbolic links will be
followed).
|
java.lang.Boolean |
hasOption(java.lang.String option)
Checks if the option is present.
|
boolean |
isDisabled(java.lang.String disableFlag,
java.lang.String setting)
Utility method to determine if one of the disable options has been set.
|
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 |
isPnpmAuditDisabled()
Returns true if the disablePnpmAudit command line argument was specified.
|
boolean |
isPurge()
Checks if the purge NVD flag has been set.
|
java.lang.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(java.lang.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(java.lang.String[] args) throws java.io.FileNotFoundException, org.apache.commons.cli.ParseException
args
- the command line argumentsjava.io.FileNotFoundException
- 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 isDisabled(java.lang.String disableFlag, java.lang.String setting)
Example given `--disableArchive` on the command line would cause this method to return true for the disable archive setting.
disableFlag
- the command line disable optionsetting
- the corresponding settings keypublic boolean isNodeAuditDisabled()
public boolean isYarnAuditDisabled()
public boolean isPnpmAuditDisabled()
public boolean isNexusUsesProxy()
public java.lang.Boolean getBooleanArgument(java.lang.String argument)
argument
- the argumentpublic java.lang.String getStringArgument(java.lang.String option)
option
- the optionpublic java.lang.String getStringArgument(java.lang.String option, java.lang.String key)
option
- the optionkey
- the dependency-check settings key for the option.public java.lang.String[] getStringArguments(java.lang.String option)
option
- the optionpublic java.io.File getFileArgument(java.lang.String option)
option
- the optionpublic void printHelp()
public java.lang.String[] getScanFiles()
public java.lang.String[] getExcludeList()
public java.lang.String[] getRetireJsFilters()
public java.lang.Boolean isRetireJsFilterNonVulnerable()
true
if non-vulnerable JS should be filtered in the
RetireJS Analyzer; otherwise null
public java.lang.String getReportDirectory()
public java.lang.String[] getReportFormat()
public java.lang.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 java.lang.String getDatabaseDriverName()
public java.lang.Integer getIntegerValue(java.lang.String argument)
argument
- the argumentpublic java.lang.Boolean hasOption(java.lang.String option)
true
; otherwise false
.option
- the option to checktrue
if auto-update is allowed; otherwise
null
public float getFailOnCVSS()
public float getFloatArgument(java.lang.String option, float defaultValue)
option
- the optiondefaultValue
- the value if the option is not presentCopyright© 2012-21 Jeremy Long. All Rights Reserved.