        --------------------------------------------------
                      CodeNarc Command Line
        --------------------------------------------------

CodeNarc - Run From Command-Line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  <<CodeNarc>> can be run from the command-line as a Java application. The <<<org.codenarc.CodeNarc>>>
  class provides the application entry-point.

* CodeNarc Command-Line Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  Usage: <<<java org.codenarc.CodeNarc [OPTIONS]>>>
  where OPTIONS are zero or more command-line parameters of the form "<<<-NAME[=VALUE]>>>"

  All command-line parameters are optional. If no parameters are supplied, <<CodeNarc>> runs from the
  current directory with reasonable defaults, as described below.

*---------------------------------+----------------------------------------------------------------------+--------------------------------------+
| <<Parameter>>                   | <<Description>>                                                      | <<Example>>                          |
*---------------------------------+----------------------------------------------------------------------+--------------------------------------+
| -basedir=<DIR>                  | The base (root) directory for the source code to be analyzed.        | -basedir=src/main/groovy             |
|                                 | Defaults to the current directory (".").                             |                                      |
*---------------------------------+----------------------------------------------------------------------+--------------------------------------+
| -includes=<PATTERNS>            | The comma-separated list of Ant-style file patterns specifying       | -includes=**/*.gr                    |
|                                 | files that must be included. Defaults to "**/*.groovy".              |                                      |
*---------------------------------+----------------------------------------------------------------------+--------------------------------------+
| -excludes=<PATTERNS>            | The comma-separated list of Ant-style file patterns specifying       | -excludes=**/templates/**,\          |
|                                 | files that must be excluded. No files are excluded when omitted.     |    **/*Test.*                        |
*---------------------------------+----------------------------------------------------------------------+--------------------------------------+
| -rulesetfiles=<FILENAMES>       | The path to the Groovy or XML RuleSet definition files, relative     | -rulesetfiles=rulesets/imports.xml,\ |
|                                 | to the classpath. This can be a single file path, or multiple paths  |    rulesets/naming.xml               |
|                                 | separated by commas. Defaults to "rulesets/basic.xml".               |                                      |
*---------------------------------+----------------------------------------------------------------------+--------------------------------------+
| -report=<REPORT-TYPE[:FILENAME]>| The definition of the report to produce. The option value is of      | -report=html                         |
|                                 | the form <<<TYPE[:FILENAME]>>>, where <<<TYPE>>> is one of the       | -report=html:MyProject.html    |
|                                 | predefined type names: "html", "xml", "text", "console" or else the fully-qualified  |                                      |
|                                 | class name of a class (accessible on the classpath) that implements  | -report=xml                          |
|                                 | the <<<org.codenarc.report.ReportWriter>>> interface. And            | -report=xml:MyXmlReport.xml          |
|                                 | <<<FILENAME>>> is the filename (with optional path) of the output    |                                      |
|                                 | report filename. If the report filename is omitted, the default      | -report=org.codenarc.report. HtmlReportWriter |
|                                 | filename for the report type is used ("CodeNarcReport.html" for      |                                      |
|                                 | "html" and "CodeNarcXmlReport.xml" for "xml"). If no report          |                                      |
|                                 | option is specified, default to a single "html" report with the      |                                      |
|                                 | default filename.                                                    |                                      |
*---------------------------------+----------------------------------------------------------------------+--------------------------------------+
| -title=<REPORT TITLE>           | The title description for this analysis; used in the output          | -title="My Project"                  |
|                                 | report(s), if provided.                                              |                                      |
*---------------------------------+----------------------------------------------------------------------+--------------------------------------+
| -help                           | Display the command-line help. If present, this must be the          | -help                                |
|                                 | only command-line parameter.                                         |                                      |
*---------------------------------+----------------------------------------------------------------------+--------------------------------------+


* Executing CodeNarc from the Command-Line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  Make sure that the following are included your CLASSPATH:

  [[1]] The Groovy jar

  [[2]] The CodeNarc jar

  [[3]] The Log4J jar

  [[4]] The directories containing (or relative to) <<CodeNarc>> config files such as "codenarc.properties"
        or ruleset files.

  []

  The CodeNarc command-line application sets an exit status of zero (0) if the command successfully executes, and
  an exit status of one (1) if an error occurs executing CodeNarc, or if an invalid command-line option is specified.

  Here is an example BAT file for running <<CodeNarc>> on Windows.

+----------------------------------------------------------------------------------------
@set GROOVY_JAR="%GROOVY_HOME%/embeddable/groovy-all-1.5.6.jar"

@java -classpath %GROOVY_JAR%;lib/CodeNarc-0.5.jar;lib/log4j-1.2.14.jar;lib org.codenarc.CodeNarc %*
+----------------------------------------------------------------------------------------

