org.owasp.dependencycheck.cli
Class CliParser

java.lang.Object
  extended by org.owasp.dependencycheck.cli.CliParser

public final class CliParser
extends Object

A utility to parse command line arguments for the DependencyCheck.

Author:
Jeremy Long (jeremy.long@owasp.org)

Nested Class Summary
static class CliParser.ArgumentName
          A collection of static final strings that represent the possible command line arguments.
 
Constructor Summary
CliParser()
           
 
Method Summary
 String getApplicationName()
          Returns the application name specified on the command line.
 String getConnectionTimeout()
          Returns the connection timeout.
 String getDataDirectory()
          Get the value of dataDirectory.
 String getProxyPort()
          Returns the proxy port.
 String getProxyUrl()
          Returns the proxy url.
 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[] getScanFiles()
          Retrieves the file command line parameter(s) specified for the 'scan' argument.
 boolean isAutoUpdate()
          Checks if the auto update feature has been disabled.
 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 isRunScan()
          Determines if the 'scan' command line argument was passed in.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CliParser

public CliParser()
Method Detail

parse

public void parse(String[] args)
           throws FileNotFoundException,
                  org.apache.commons.cli.ParseException
Parses the arguments passed in and captures the results for later use.

Parameters:
args - the command line arguments
Throws:
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.

isGetVersion

public boolean isGetVersion()
Determines if the 'version' command line argument was passed in.

Returns:
whether or not the 'version' command line argument was passed in

isGetHelp

public boolean isGetHelp()
Determines if the 'help' command line argument was passed in.

Returns:
whether or not the 'help' command line argument was passed in

isRunScan

public boolean isRunScan()
Determines if the 'scan' command line argument was passed in.

Returns:
whether or not the 'scan' command line argument was passed in

printHelp

public void printHelp()
Displays the command line help message to the standard output.


getScanFiles

public String[] getScanFiles()
Retrieves the file command line parameter(s) specified for the 'scan' argument.

Returns:
the file paths specified on the command line for scan

getReportDirectory

public String getReportDirectory()
Returns the directory to write the reports to specified on the command line.

Returns:
the path to the reports directory.

getReportFormat

public String getReportFormat()
Returns the output format specified on the command line. Defaults to HTML if no format was specified.

Returns:
the output format name.

getApplicationName

public String getApplicationName()
Returns the application name specified on the command line.

Returns:
the application name.

getConnectionTimeout

public String getConnectionTimeout()
Returns the connection timeout.

Returns:
the connection timeout

getProxyUrl

public String getProxyUrl()
Returns the proxy url.

Returns:
the proxy url

getProxyPort

public String getProxyPort()
Returns the proxy port.

Returns:
the proxy port

getDataDirectory

public String getDataDirectory()
Get the value of dataDirectory.

Returns:
the value of dataDirectory

printVersionInfo

public void printVersionInfo()

Prints the manifest information to standard output.


isAutoUpdate

public boolean isAutoUpdate()
Checks if the auto update feature has been disabled. If it has been disabled via the command line this will return false.

Returns:
if auto-update is allowed.


Copyright © 2012-2013 OWASP. All Rights Reserved.