Archi Command Line Interface

Phil Beauvoir edited this page Sep 10, 2018 · 7 revisions

Introduction

Since version 4.2, some Archi functions can be invoked from the Archi Command Line Interface (ACLI). This can be useful for automating tasks. It means that Archi runs without launching a GUI.

Basic format

The basic format of the CLI is as follows.

Windows

Archi -application com.archimatetool.commandline.app -consoleLog -nosplash [options...]

Linux

./Archi -application com.archimatetool.commandline.app -consoleLog -nosplash [options...]

Mac

Archi.app/Contents/MacOS/Archi -application com.archimatetool.commandline.app -consoleLog -nosplash [options...]

Use

This can be invoked from a terminal interface or as part of a script (bash, batch, etc). The parts of this line are:

Archi - the name of the Archi application binary

-application com.archimatetool.commandline.app - this ensures that the ACLI and not the main application is launched

-consoleLog - ensures that a log is visible to display messages and exceptions

-nosplash - Don't show a splash screen when launching

[options...] - various options for different tasks.

Commands and options

To find out what commands and options are available, use the -h or --help option:

Archi -application com.archimatetool.commandline.app -consoleLog -nosplash --help

This will print to console all available options and installed CLI providers:

usage: Archi -application com.archimatetool.commandline.app -consoleLog -nosplash [options...]

Common options:
---------------
 -a,--abortOnException          If present all further command line providers will not run when an exception is thrown
 -h,--help                      Show this help
 -p,--pause                     If present the console log will stay open until the RETURN key is pressed

Registered providers:
---------------------
 [Create Empty Model] Create an empty model and set to the current model (from optional template)
 [Load & Clone Collaboration Model] Load and/or clone from a local or online collaboration repository and set to the current model
 [Load Model] Load a model from file and set to the current model
 [Import from Open Exchange XML format] Import from an Open Exchange XML format file and set to the current model
 [Import from CSV] Import data from CSV into the current model
 [Run an Archi Script File] Run an Archi Script File
 [Export to Open Exchange XML format] Export the current model to the Open Exchange XML file format
 [HTML Reports] Generate a HTML report from the current model
 [Jasper Reports] Generate Jasper Reports from the current model
 [Export to CSV] Export the current model to CSV file format
 [Save Model] Save the current model to file

Options:
--------
   --createEmptyModel <*.architemplate file>           Create an empty model and set to the current model. If <*.architemplate file> is set,
                                                       this will be used as the model's template.
   --csv.export <path>                                 Export the current model in CSV format to the given path.
   --csv.exportDelimiter <delimiter>                   Delimiter to use for CSV export. One of "," ";" or "\t" (optional, default is ",")
   --csv.exportEncoding <encoding>                     Encoding to use for CSV export. One of "UTF-8", "UTF-8 BOM" or "ANSI" (optional,
                                                       default is "UTF-8",)
   --csv.exportFilenamePrefix <prefix>                 Prefix for file names to use for CSV export (optional, default is none).
   --csv.exportLeadingZeros                            Use Excel leading zeros/spaces workaround for CSV export (optional, default is
                                                       false).
   --csv.exportStripNewLines                           Strip newline characters for CSV export (optional, default is false).
   --csv.import <elements.csv file>                    Import into the current model in CSV format from the supplied elements.csv file.
   --html.createReport <path>                          Create a HTML Report from the current model to the folder set at <path>.
   --jasper.createReport <path>                        Create Jasper Reports from the current model to the folder set at <path>.
   --jasper.filename <name>                            File name to use for Jasper Reports (required).
   --jasper.format <format>                            List of comma separated output formats for Jasper Reports. Any of
                                                       PDF,HTML,RTF,PPT,ODT,DOCX (optional, default is PDF).
   --jasper.locale <locale>                            Locale for Jasper Reports in "en_GB" format (optional, default is the current system
                                                       locale).
   --jasper.template <main.jrxml>                      Full path to the main.jrxml Jasper Reports template file (optional, default is
                                                       Customisable Report).
   --jasper.title <title>                              Title of Jasper Reports (required).
   --loadModel <*.archimate file>                      Load a *.archimate model from file and set to the current model.
   --modelrepository.cloneModel <url>                  Clone a collaboration model from <url> to the <path> set in option
                                                       --modelrepository.loadModel (optional).
   --modelrepository.loadModel <path>                  Load a collaboration model from the given repository folder at <path> (required if
                                                       option --modelrepository.cloneModel is used).
   --modelrepository.passFile <password file>          Path to a file containing the online repository login password (required if option
                                                       --modelrepository.cloneModel is used).
   --modelrepository.userName <userName>               Online repository login user name (required if option --modelrepository.cloneModel is
                                                       used).
   --saveModel <*.archimate file>                      Save the current model to a *.archimate file.
   --script.runScript <script file>                    Run the script in the given file
   --xmlexchange.export <path>                         Export the current model in Open Exchange XML format to <path>.
   --xmlexchange.exportFolders                         If set, the model's folder structure will be exported as an <organization> structure
                                                       (optional, default is false).
   --xmlexchange.exportLang <lang>                     Two letter language code for export. Example - en, fr, de (optional, default is
                                                       none).
   --xmlexchange.import <*.xml file>                   Import an XML Open Exchange file and set to the current model.

Priorities

Each CLI provider has a priority according to its type:

PRIORITY_LOAD_OR_CREATE_MODEL = 10
PRIORITY_IMPORT = 20
PRIORITY_RUN_SCRIPT = 30
PRIORITY_REPORT_OR_EXPORT = 40
PRIORITY_SAVE_MODEL = 50

Lower numbers mean that this action will occur first. i.e. loading or creating an empty model will occur before importing from CSV, which will occur before exporting or saving.

This ensures that you can use more than one CLI provider's options on the same command line without worrying about the order of the options.

The Current Model

There is the notion of the "Current Model" (CM). This is the current ArchiMate model loaded into memory that can be used as the basis for further tasks.

Some examples

To create a blank, empty model and set this to the CM:

Archi -application com.archimatetool.commandline.app -consoleLog -nosplash --createEmptyModel

To load a given model from file and set this to the CM:

Archi -application com.archimatetool.commandline.app -consoleLog -nosplash --loadModel "\path\mymodel.archimate"

To load a given model from file and set this to the CM and then export to CSV in the set output folder:

Archi -application com.archimatetool.commandline.app -consoleLog -nosplash --loadModel "\path\mymodel.archimate" --csv.export "\path\output"

Running on Linux without graphics (headless)

Because some libraries depend on having a display driver, if you run the ACLI from Linux you may need to install and run certain libraries like gtk3 and xvfb. For example:

Xvfb :99 && export DISPLAY=:99
Archi -application com.archimatetool.commandline.app -consoleLog -nosplash --options
pkill -f 'Xvfb :99'
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.