Command Line Reference

Globalyzer Command Line Client

The Command Line Client allows you to run much of the Globalyzer GUI Client from a command line, such as listing project and scan information, scanning, exporting and importing. In addition, it supports calculating and reporting on the differences in scans.

Note: Not all Globalyzer functionality is available from the command line; you will still need the Globalyzer GUI Client to create projects and scans and for code fixing, such as string externalization.

To run the Command Line Client, cd to the program directory, where you installed the Globalyzer Client, and enter:

java -jar globalyzer-cli.jar command [<command option> [<option value>]]

The following lists commands and options; there are both short and long versions for each.

Data Directory Command

The data directory command is used to specify the location of the Globalyzer Data Directory, where Globalyzer stores internal files. The default location is [userhome]/.globalyzer. If the default location is specified during the install, and the default location is the desired location to store the information, then this command is not necessary.

This command must be used when the default location is NOT specified during the install, or if the desired location is different from what was specified at installation time.



Setting Data Directory Location during Installation
When installing the Globalyzer Client, you are prompted to specify the location of the data directory. The default is [userhome]/.globalyzer. If you specify a different location, then you must include the -d flag in all Globalyzer Command Line Client (or Ant Client) statements.

-d,--datadir <arg>

Full path to Globalyzer data directory

Example: java -jar globalyzer-cli.jar --datadir "C:/GlobalyzerData"

Setting Data Directory Location after Installation
If you want the data directory location to be different from the installed location, the following modifications need to be made:

  1. Modify the globalyzer.ini file (located in the install directory) and set the -datadir to your new location

    -datadir full/path/to/directory

  2. Modify the log4j2.xml file (located in the install directory) and set paths correctly to globalyzer.log and globalyzer_log.html

    log4j.appender.FILE.File=C:/GlobalyzerData/log/globalyzer.log
    log4j.appender.TMPHTML.File=C:/GlobalyzerData/log/globalyzer_log.html


  3. Specify --datadir flag in all Command Line Client and Ant Client commands.

    Example: java -jar globalyzer-cli.jar --datadir "C:/GlobalyzerData"

Log File Command

Use the logfile or logurl command to set the location of the log4j2.xml file. On client installation, the log4j2.xml file is placed in the install directory. If Command Line Client commands are executed from the install directory, then this flag is not necessary. If Command Line Client commands are executed outside of the install directory, then this flag must be used to tell Globalyzer where to find the log4j2.xml file.


-lf,--logfile <arg>


Full path to Globalyzer log4j.properities file
-lu,--logurl <arg> URL to Globalyzer log4j.properities file

Help Command

The Help command prints detailed usage and summary information for all commands and options.

Example: java -jar globalyzer-cli.jar --help
-h,--help Globalyzer Command Line help

Version Command

The Version command prints version information for both the Client and the Server.

Example: java -jar globalyzer-cli.jar --version
-ver,--version Prints Globalyzer version of Client and Server

Login Commands

The Login commands are used to log into Globalyzer from the command line. This requires user, password and server commands, as well as proxy login information if you are connected to the internet via a proxy server.

Note: You only need to run the Login command unless the options values change.

Example:
java -jar globalyzer-cli.jar -u your@email -p yourPassword -s https://www.globalyzer.com/gzserver
-u,--user <arg> Globalyzer username (email)
-p,--password <arg> Globalyzer password
-s,--server <arg> Globalyzer Server URL
-pusr,--proxy-user <arg> Proxy user
-ppswd,--proxy-password <arg> Proxy password
-pport,--proxy-port <arg> Proxy port
-phost,--proxy-host <arg> Proxy host

List Commands

Use the List commands to see a list of your projects, scans, Rule Sets and saved reports. In the case of list-scans and list-reports, you will need to provide a project-name. Include verbose to see detailed information.

Example: java -jar globalyzer-cli.jar --list-projects
-lrule,--list-rulesets Lists Rule Sets defined for the user
-lp,--list-projects Lists the available projects
     -v,--verbose Verbose output
-ls,--list-scans Lists the available scans for project
     -pn,--project-name <arg> Project name
     -v,--verbose Verbose output
-lr,--list-reports Lists the available reports for project
     -pn,--project-name <arg> Project name
     -v,--verbose Verbose output

Scan Command and Options

Use the Scan command to analyze your source code for internationalization (i18n) issues. By comparing scans using the diff command (see below), you have the ability to automate the detection of new i18n issues. Use verbose to see a list of scanned files.
Note: Use -Xmx512m parameter to give the JVM more memory for scanning.

Example:
java -Xmx512m -jar globalyzer-cli.jar --scan -pn MyProject -sn MyScan
-scn,--scan Scans source code
     -pn,--project-name <arg> Project name (required)
     -sn,--scan-name <arg> Scan name, if not specified, all scans for the specified project are scanned
     -ml,--machine-learning Apply machine-learning files (if they exist) for the scan
     -v,--verbose Verbose output

Scan History Command and Options

Use the Scan History command to retrieve the Scan History table, which is updated each time you run a Globalyzer scan. Include result-type to specify which results to retrieve (default is embedded), and ascending to sort the table results from earliest to latest (default is latest to earliest). Use xml-name to output the results to a file in XML format.

You can use XSL transformation (-xslfile, --xsl-file) to generate the Scan History in output format (html, text, etc) defined in your XSL transformation file. XSL transformation uses XML format as input to the transformation. Click here for more information on using XSL transformation and for a description of the default XSL files installed with the Globalyzer Client.

Example:
java -jar globalyzer-cli.jar --scan-history -pn MyProject -sn MyScan -res method -xml MyOutputFile
-shist,--scan-history Shows scan results history
     -pn,--project-name <arg> Project name
     -sn,--scan-name <arg> Scan name
     -res,--result-type <arg> Scan result type (embedded,method,general,static)
     -asc,--ascending Sort results in ascending order (oldest first)
     -xml,--xml-name <arg> XML file name
     -xslfile,--xsl-file <arg> XSL transformation file name
     -rfile,--report-file <arg> Report file name
     -stdout,--stdout Send report to standard output

Scan Diff Command and Options

Use the Scan Diff command to compare scans, returning the number of increased or decreased issues. By including this command in your build process, you can be notified when there are new internationalization issues to analyze. You will need to either specify a from-date and to-date or a from-id and to-id. Use result-type to retrieve just the difference for one scan type and xml-name to output the results in XML format.

You can use XSL transformation (-xslfile, --xsl-file) to generate the Scan Difference report in output format (html, text, etc) defined in your XSL transformation file. XSL transformation uses XML format as input to the transformation. Click here for more information on using XSL transformation and for a description of the default XSL files installed with the Globalyzer Client.

Note: The Scan Diff command will only work if you specify dates or ID's that relate to valid scans. You can use the Scan History command to determine which dates scans were performed on. Dates should be entered using the international standard, yyyy-MM-dd HH:mm.

Example:
java -jar globalyzer-cli.jar --scan-diff -pn MyProject -sn MyScan --from-date "2009-05-01 17:00" --to-date "2009-06-01 17:00"
-sd,--scan-diff Display difference between scan results
     -pn,--project-name <arg> Project name
     -sn,--scan-name <arg> Scan name
     -res,--result-type <arg> Scan result type (embedded,method,general,static)
     -from,--from-date <arg> Specify the from date to diff
     -to,--to-date <arg> Specify the to date to diff
     -fid,--from-id <arg> Specify the from id to diff
     -tid,--to-id <arg> Specify the to id to diff
     -xml,--xml-name <arg> XML file name to write diff data
      Use this if not performing an XSL transformation
     -xslfile,--xsl-file <arg> XSL transformation file name
     -rfile,--report-file <arg> Report file name
      Use this if performing an XSL transformation
     -stdout,--stdout Send report to standard output

Rule Set Diff Command and Options

Use the Rule Set Diff command to compare two Rule Sets. The Rule Sets must be accessible by the current user; that is, the Rule Sets must be owned by the current user or shared by a team member. A report is generated detailing the differences. The report is either sent to standard output, or written to an HTML file.

Note that the current user may be able to access multiple Rule Sets with the same name (different owners); in these situations, specify the owner using the owner option.

Example:
java -jar globalyzer-cli.jar -rsd -r1 MyJavaRuleSet -r2 JavaRuleSet -o2 johndoe@company.com -html rulesetdiff.html
-rsd,--rule-set-diff Display difference between two rule sets
     -r1,--rule-set-1 <arg> Rule Set name
     -o1,--owner-1 <arg> Owner (email address) of Rule Set 1
     -r2,--rule-set-2 <arg> Rule Set name
     -o2,--owner-2 <arg> Owner (email address) of Rule Set 2
     -html,--html-file <arg> HTML file name to write diff data
     -stdout,--stdout Send report to standard output

Delete Scan Results Command and Options

Use the Delete Scan Results command to delete one or more scan results from Globalyzer's data storage. This allows you to do a fresh scan, rather than an incremental one. Include only project-name to delete the results for all scans in the project. Add scan-name to limit deletion to a single scan.

Example:
java -jar globalyzer-cli.jar --delete-scan-results -pn MyProject -sn MyScan
-dsr,--delete-scan-results Delete results of specified scan or all scans
     -pn,--project-name <arg> Project name
     -sn,--scan-name <arg> Scan name

Delete Project Command and Options

Use the Delete Project command to delete a project and all its scans from Globalyzer's data storage.

Example:
java -jar globalyzer-cli.jar --delete-project -pn MyProject
-dp,--delete-project Delete specified project
     -pn,--project-name <arg> Project name

Run Scan Report Command and Options

Use the Run Scan Report command to produce various reports from your Globalyzer scan data. For an aggregate report of all scans, include just the project-name option; all other report types additionally require the scan-name option. Specify the report-file to override the default name of the output file. If you include stored-report, which is the filename of a report that you saved in the Globalyzer Workbench, Globalyzer will retrieve the report type, results, title and file encoding, as needed to generate the report. Otherwise, include the other options to set the desired report type values.

You can use XSL transformation (-xslfile, --xsl-file) to generate a Detailed Scan report in output format (html, text, etc) defined in your XSL transformation file. XSL transformation uses XML format as input to the transformation. Click here for more information on using XSL transformation and for a description of the default XSL files installed with the Globalyzer Client.

Example of Excel report for scan:
java -jar globalyzer-cli.jar --run-report -pn MyProject -sn MyScan -rfile MyProject_Report
-rr,--run-report Run Report
     -pn,--project-name <arg> Project name
     -sn,--scan-name <arg> Scan name
     -srep,--stored-report <arg> Stored report name
     -rtype,--report-type <arg> Report type: aggregate|summary|csv|excel|html|text|xml|xsl
     -res,--result-type <arg> Result types (comma-separated): all|embedded,method,general,static
     -rtitle,--report-title <arg> Report title for HTML summary report
     -enc,--encoding <arg> Encoding (utf-8|utf-16|...)
     -xslfile,--xsl-file <arg> XSL transformation file name
     -rfile,--report-file <arg> Report file name
     -stdout,--stdout Send report to standard output

Export Data Command and Options

The Export command can be used to back up all your Globalyzer data (do not include a project-name or scan-name), a specific Project (include project-name) and its Scans' data, or just a single Scan's data(include project-name and scan-name). Be sure to add the include-results option if you want to include the scan results in the file.

Example of Project Export:
java -jar globalyzer-cli.jar --export -pn MyProject -ename ProjectDataFilename
-exp,--export Export all (gbak), project (gproj) or specified scan (gscan)
     -pn,--project-name <arg> Project name
     -sn,--scan-name <arg> Scan name
     -inc,--include-results Include scan results in gproj and gscan
     -ename,--export-name <arg> Export file name

Import Data Command and Options

The Import command can be used to import the data that was exported from Globalyzer; either all your Globalyzer data (gbak file extension), a specific Project and its Scans (gproj file extension), or just a single Scan (gscan file extension). Be sure to add the include-results option if you want to include any scan results that were saved in the file. In the case of a single Scan import, you will need to provide the project-name. The reconcile-import option should be used if your import data is referencing Source code and Rule Sets that you don't match what you have. The Reconcile file must be in XML format and should contain the following:

<reconcile>
<basepath project="NameFromFile" path="YourBasePath"/>
<ruleset project="NameFromFile" scan="NameFromFile" name="YourRuleSet"/>
</reconcile>

For all the projects in the import file, you will need to enter a basepath XML tag to set the base path of the source code. Then, for all scans in the import file, you will need to enter a ruleset XML tag to set the matching Rule Set. Make sure that the programming language of your Rule Set exactly matches the one from the import file.

Note: If importing a project which already exists in your workspace, Globalyzer automatically merges (combines) the imported project with your existing project. For example, if your local project contains a scan not in the imported project, merge will retain your scan. If a scan exists in both your local project and the imported one, the imported scan overwrites your local scan. If you want only the imported project, then delete your local project before importing.

Example of Project Import:
java -jar globalyzer-cli.jar --import -pn MyProject -iname ProjectDataFilename
-imp,--import Import all (gbak), project (gproj) or scan (gscan)
     -pn,--project-name <arg> Project name
     -inc,--include-results Include scan results in gproj and gscan
     -iname,--import-name <arg> Import file name
     -rec,--reconcile-import <arg> Reconcile import data XML file