#modeling #domain #language #cli #convert #draw #tree-sitter

yanked sdml

Rust CLI for Simple Domain Modeling Language (SDML)

1 unstable release

0.1.2 Jun 9, 2023

#84 in #draw

22 downloads per month

MIT license

255KB
6K SLoC

Crate sdml

Rust CLI for Simple Domain Modeling Language (SDML).

MIT License Rust Security audit Codecov GitHub stars

This is a command-line tool that provides functionality to process SDML files.

Commands

For most commands the tool accepts a pair of arguments that determine the format and location of the generated output. These commands --output-format/-f and --output-file/-o can be used in the following manner.

--output-format svg --output-file rentals.svg
-output-file rentals.svg

In the second example above the format is not specified and so the tool will use the extension of the output file as the format specifier. If the output file is not specified the output is written to stdout. If neither argument is provided the output is written to stdout in the default format.

Similarly most tools use the module resolution rules for loading a module and so the input file is actually specified as a module name. To allow for searches in non-standard locations the argument --base-path/-b can be used to prepend a path to the standard search path. Thus the two examples below are identical as the current directory is always a component of the search path.

--base-path . rentals
rentals

Convert

Conversion to an Emacs org-Mode file provides a documentation format with the most complete options.

sdml convert --output-format org-mode rentals

This command converts the SDML surface syntax into it's underlying RDF representation.

sdml convert --output-format org-mode rentals

This command convert the SDML surface syntax into an expanded version of the s-expressions used in tree-sitter queries.

sdml convert --output-format org-mode rentals

Highlight

For the console this uses ANSI escape sequences to format the text.

sdml highlight --output-format ansi rentals

To generate formatted and highlighted HTML the tool accepts two different format specifiers, html for simply a block of HTML that can be inserted into another document, or html-standalone to generate a full document around the highlighted code block.

sdml highlight --output-format html rentals
sdml highlight --output-format html-standalone rentals

Draw

To draw a high-level Concepts diagram, use the diagram specifier concepts.

sdml draw --diagram concepts \
          --output-format svg --output-file rentals.svg \
          --base-path . rentals

For more detail an Entity-Relationship diagram can be generated with the diagram specifier entity-relationship.

sdml draw --diagram entity-relationship \
          --output-format svg --output-file rentals.svg \
          --base-path . rentals

For the mose detail a UML Class diagram can be generated with the diagram specifier uml-class.

sdml draw --diagram uml-class \
          --output-format svg --output-file rentals.svg \
          --base-path . rentals

Other Links

Formatting:

Linting:

Changes

Version: 0.1.2

  • Syntax highlighting supported
  • Support the latest grammar

Version: 0.1.1

  • More drawing details
  • More command-line features
  • Support the latest grammar

Version: 0.1.0

  • Initial version, limited to basic drawings

Dependencies

~13–27MB
~421K SLoC