scitools.com

← All und commands

und is the command-line interface to Understand — script project creation, analysis, CodeCheck, metrics, and reports, locally or in CI.

und export

exports settings, dependencies, macros, includes, arches, changes, or annotations

The export command can be run in several ways:

1) Export Project Settings

This is the default. It exports the project settings to a backup XML file. It requires the file name to export to and has no switches. It is run in the format (und export [filename] [database]) So, it could be run like this:

und export toHere.xml myProject.und
und -db myProject.und export toHere.xml
export toHere.xml    (Interactive mode)

Note: the database is the very last argument, so this would NOT work:

und export myProject.und toHere.xml

2) Export Architecture

This exports an architecture to an XML file. It requires the name of the architecture to export and the file to export to and it also has no switches. It is run in the format (und export -arch [archname] [filename] [database]). So, it could be run like this:

und export -arch "Directory Structure" toHere.xml myProject.und
und -db myProject.und export -arch "Directory Structure" toHere.xml
export -arch "Directory Structure" tohere.xml (Interactive mode)

3) Export Dependencies

File, architecture, and class (kind) dependencies can all be exported and they can each be exported as a CSV, matrix, or Cytoscape (type). The CSV and matrix both generate excel documents (.csv). For more information on Cytoscape, see http://cytoscape.org. The general format of the command is (export -dependencies [options] kind type outputFile). For example:

und export -dependencies file csv output.csv myProject.und

would export the file dependencies in myProject.und to output.csv and

und export -dependencies class matrix output.csv myProject.und

would export the class dependencies to output.csv in matrix format. The architecture export requires the additional argument of an architecture name, which should appear right after "arch" so it would look like this:

und export -dependencies arch myArch csv output.csv myProject.und

There are several switches which can be used with this command:

OptionDescription
-modeThis determines whether link time or compile time dependencies are used. The options are <compile,link>. When not provided, the project setting is used (link time is default).

Note: the following switches do not apply for Cytoscape:

OptionDescription
-colThe five columns in the output file are "From File," "To File," "References," "From Entities," and "To Entities." The last three columns can be specified using <none,refs,froments,toents,all> for files, architecture, and classes. For architecture, the first two columns can also be specified using <fromfiles,tofiles>. By default, all columns are included. So, using -col refs would have only the "ToFile," "From File," and "References" columns.
-formatThis determines the format of the filenames as seen in the output file. The options are <short,long,longnoroot> with the default as longnoroot
-sortThis determines whether entries are sorted by the "To File" or "From File" columns. <to,from> The default is from.
-groupBy default, there is no grouping. Each file-file dependency has has it's own entry. The -group option allows the entries to be grouped by either the "To File" or "From File" columns. So, grouping by the from column would list all the files that have dependencies, but instead of listing each "to" file separately, it would give the total number of "to" files found. The command takes the parameters <to,from,none>, with the default as none.

Switches appear before the arguments, so a command with switches in it might look like this

und export -dependencies -col refs froments -sort to -format short file csv output.csv myProject.und

4) Export Macros / Includes

This prints a list of macros or includes to the screen. It has the format und export -[macros/includes]. For example,

export -macros (Interactive Mode)
export -includes (Interactive Mode)

It has one available switch:

OptionDescription
-langSpecify the language to export macros/includes for. If this switch is not provided, all macros/includes will be listed.

5) Export changed entities

Save the changed entities between this database and the comparison database to the provided filename as a csv table. Available switches are:

OptionDescription
-cmpdbuse the provided database instead of the current comparison database
-kindslimit the export to entities matching the kind string
-columnsa comma separated list of the columns to export

Switches appear before the filename argument, so a command could look like this:

und export -changes -columns "Status,Long Name,PercentChanged"\
  -kinds "file" -cmpdb mycomparisonproj.und outputFileName.csv
Valid Columns are:
  Status
  Name
  Long Name
  Unique Name
  Kind Short Name
  Kind Long Name
  File Name
  File Relative Name
  File Long Name
  CountLineNew
  CountLineRemoved
  CountLineChanged
  PercentChanged
  Any metric api name (Cyclomatic, CountLine, etc)
The default columns are:
  Status
  Long Name
  Unique Name
  Kind Long Name
  File Relative Name
  CountLineNew
  CountLineRemoved
  CountLineChanged
  PercentChanged
  CountLine
  CountLineCode
  CountPath
  Cyclomatic
  SumCyclomatic

6) Export annotations

The -annotations switch exports the project's annotations to a file in SARIF (Static Analysis Results Interchange Format) JSON. It takes the output file name as the last argument.

und export -annotations annotations.sarif myProject.und