SDML(1) | User Commands | SDML(1) |
sdml view - View formatted module source.
sdml view [OPTIONS] [MODULE]
View formatted module source.
This command will generate source code from a module file, which at first seems redundant. However, this view provides levels of detail that allow for an overview of module definitions. The `--level` argument can be used to elide content and get an overview of a module.
- Definitions (default) :: Show only the definitions in the module, any definition body will be elided, for an overview of the module contents. Elided definitions are followed by `";; ..."`.
```text ??? sdml view --level definitions -i examples/example.sdm module example <https://example.com/api> is
import [ dc xsd ]
datatype Uuid <- sdml:string ;; ...
entity Example ;; ...
end ```
- Members :: Show definitions in the module and show the members of product types and variants of sum types but not their bodies if present.
```text ??? sdml view --level members -i examples/example.sdm module example <https://example.com/api> is
import [ dc xsd ]
datatype Uuid <- sdml:string ;; ...
entity Example is version -> Uuid name -> sdml:string ;; ... end
end ```
- Full :: Show all contents of the module.
```text ??? sdml view --level full -i examples/example.sdm module example <https://example.com/api> is
import [ dc xsd ]
datatype Uuid <- sdml:string is @xsd:pattern = "[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}" end
entity Example is version -> Uuid name -> sdml:string is @dc:description = "the name of this thing"@en end end
end ```
Indentation level can also be specified, although the default remains 2 spaces.
-l, --level <LEVEL>
-s, --indent-spaces <INDENT_SPACES>
-o, --output <OUTPUT>
-i, --input <INPUT>
-h, --help
-V, --version
October 2024 | sdml view 0.3.1+20241014 |