table of contents
SDML(1) | User Commands | SDML(1) |
NAME¶
sdml view - View formatted module source.
SYNOPSIS¶
sdml view [OPTIONS] [MODULE]
DESCRIPTION¶
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.
Arguments:¶
- [MODULE]
- SDML module, loaded using the standard resolver
OPTIONS¶
-l, --level <LEVEL>
- [default: definitions]
- Possible values: - definitions: Top-level definitions, incomplete - members: Top-level definitions and members, incomplete - full: Full source
-s, --indent-spaces <INDENT_SPACES>
- Set the number of spaces for indentation
- [default: 2]
-o, --output <OUTPUT>
- File name to write to, or '-' to write to stdout
- [default: -]
-i, --input <INPUT>
- Input SDML file name to read from, or '-' to read from stdin
- [default: -]
-h, --help
- Print help (see a summary with '-h')
-V, --version
- Print version
October 2024 | sdml view 0.3.0+20240901 |