Skip to content

ContextMapper/context-mapper-cli

Repository files navigation

Context Mapper

Context Mapper CLI

Build (master) codecov License Maven Central

This repository contains the Context Mapper CLI - a command line interface to validate CML files and call generators (currently PlantUML, Context Map, and generic text files via Freemarker template).

Download

The CLI can be downloaded under the following links:

  • TAR (Linux, Mac)
  • ZIP (Windows)

In case you want to include Context Mapper in your Maven or Gradle build, you can use the CLI to call generators (for example with Maven exec plugin).

Gradle:

implementation 'org.contextmapper:context-mapper-cli:6.11.1'

Maven:

<dependency>
  <groupId>org.contextmapper</groupId>
  <artifactId>context-mapper-cli</artifactId>
  <version>6.11.1</version>
</dependency>

Validate Command Usage

$ ./cm validate -h
Context Mapper CLI
usage: cm validate
 -h,--help          Prints this message.
 -i,--input <arg>   Path to the CML file which you want to validate.

Generate Command Usage

$ ./cm generate -h
Context Mapper CLI
usage: cm generate
 -f,--outputFile <arg>   The name of the file that shall be generated
                         (only used by Freemarker generator, as we cannot
                         know the file extension).
 -g,--generator <arg>    The generator you want to call. Use one of the
                         following values: context-map (Graphical DDD
                         Context Map), plantuml (PlantUML class-,
                         component-, and state diagrams.), generic
                         (Generate generic text with Freemarker template)
 -h,--help               Prints this message.
 -i,--input <arg>        Path to the CML file for which you want to
                         generate output.
 -o,--outputDir <arg>    Path to the directory into which you want to
                         generate.
 -t,--template <arg>     Path to the Freemarker template you want to use.
                         This parameter is only used if you pass 'generic'
                         to the 'generator' (-g) parameter.

Usage examples

The following examples illustrate the CLI usage.

Validate *.cml File

./cm validate -i DDD-Sample.cml

Generate PlantUML

./cm generate -i DDD-Sample.cml -g plantuml -o ./output-directory

Generate Context Map

./cm generate -i DDD-Sample.cml -g context-map -o ./output-directory

Generate Arbitrary Text File with Freemarker Template

./cm generate -i DDD-Sample.cml -g generic -o ./output-directory -t template.md.ftl -f glossary.md

Development / Build

If you want to contribute to this project you can create a fork and a pull request. The project is built with Gradle, so you can import it as Gradle project within Eclipse or IntelliJ IDEA (or any other IDE supporting Gradle).

Contributing

Contribution is always welcome! Here are some ways how you can contribute:

Licence

ContextMapper is released under the Apache License, Version 2.0.