This guide covers getting started with the reference implemention Monogram-Go.
You can install the monogram command-line tool or the Go library, if you want
to write a Go application that uses Monogram notation, or both!
Command-line:
Go Library
Once you have installed the monogram tool, you can use it to process and
analyze monogram notation directly from the command line. Listed below are some
common use cases and examples to help you get started.
Once installed, you can invoke the Monogram CLI tool using the monogram
command. For example:
monogram [flags] [arguments]To see a list of available commands and options, run:
monogram --help-
Processing a Monogram File
To process a monogram file and output the result in a specific format (e.g., JSON):
monogram -format json < input.monogramReplace
input.monogramwith the path to your monogram file. -
Specifying Output File
To save the output to a file instead of printing it to the terminal:
monogram --format xml --o output.xml -i input.monogram
This will process the
input.monogramfile and save the result asoutput.xml. -
Using Indentation
To control the indentation level in the output (e.g., for JSON or XML):
monogram -format json -indent 4 -i input.monogram
This will format the output with 4 spaces of indentation.
-
Including Spans
To include span information in the output (useful for debugging) and emit as YAML:
monogram -include-spans -format yaml -i input.monogram
Here are some commonly used flags:
-format <format>: Specify the output format. Supported formats includejson,xml,yaml,mermaid, anddot.-output <file>: Specify the output file. If omitted, the output is printed to the terminal.-indent <number>: Set the number of spaces for indentation in the output.-include-spans: Include span information in the output.
This will display a comprehensive list of available options and their descriptions.
You can also start up with monogram --test. This runs a local web-server and
opens a web page that allows you to experiment with Monogram. It's a neat way to
learn more about the notation and to find problems.
Follow this link to learn more about this option.