160 lines
4.6 KiB
Markdown
160 lines
4.6 KiB
Markdown
# treerack
|
|
|
|
## Synopsis:
|
|
|
|
```
|
|
treerack <subcommand>
|
|
```
|
|
|
|
## Options:
|
|
|
|
- --help: Show help.
|
|
|
|
## Subcommands:
|
|
|
|
Show help for each subcommand by calling \<command\> help or \<command\> --help.
|
|
|
|
### treerack check-syntax
|
|
|
|
#### Synopsis:
|
|
|
|
```
|
|
treerack check-syntax [options]... [--] [args string]...
|
|
treerack check-syntax <subcommand>
|
|
```
|
|
|
|
Expecting max 1 total number of arguments.
|
|
|
|
#### Description:
|
|
|
|
validates a syntax definition. The syntax may be provided via a file path (using an option or a positional
|
|
argument), an inline string, or piped from standard input.
|
|
|
|
#### Options:
|
|
|
|
- --syntax string: specifies the filename of the syntax definition file.
|
|
- --syntax-string string: specifies the syntax as an inline string.
|
|
- --help: Show help.
|
|
|
|
### treerack check
|
|
|
|
#### Synopsis:
|
|
|
|
```
|
|
treerack check [options]... [--] [args string]...
|
|
treerack check <subcommand>
|
|
```
|
|
|
|
Expecting max 1 total number of arguments.
|
|
|
|
#### Description:
|
|
|
|
parses input content against the provided syntax definition and fails if the input does not match. Syntax can be
|
|
provided via a filename option or an inline string option. Input can be provided via a filename option, a
|
|
positional argument filename, an inline string option, or piped from standard input.
|
|
|
|
#### Options:
|
|
|
|
- --input string: specifies the filename of the input content to be validated.
|
|
- --input-string string: specifies the input content as an inline string.
|
|
- --syntax string: specifies the filename of the syntax definition file.
|
|
- --syntax-string string: specifies the syntax as an inline string.
|
|
- --help: Show help.
|
|
|
|
### treerack show
|
|
|
|
#### Synopsis:
|
|
|
|
```
|
|
treerack show [options]... [--] [args string]...
|
|
treerack show <subcommand>
|
|
```
|
|
|
|
Expecting max 1 total number of arguments.
|
|
|
|
#### Description:
|
|
|
|
input content against a provided syntax definition and outputs the resulting AST (Abstract Syntax Tree) in JSON
|
|
format. Syntax can be provided via a filename option or an inline string option. Input can be provided via a
|
|
filename option, a positional argument filename, an inline string option, or piped from standard input.
|
|
|
|
#### Options:
|
|
|
|
- --indent string: specifies a custom indentation string for the output.
|
|
- --input string: specifies the filename of the input content to be validated.
|
|
- --input-string string: specifies the input content as an inline string.
|
|
- --pretty bool: enables indented, human-readable output.
|
|
- --syntax string: specifies the filename of the syntax definition file.
|
|
- --syntax-string string: specifies the syntax as an inline string.
|
|
- --help: Show help.
|
|
|
|
### treerack generate
|
|
|
|
#### Synopsis:
|
|
|
|
```
|
|
treerack generate [options]... [--] [args string]...
|
|
treerack generate <subcommand>
|
|
```
|
|
|
|
Expecting max 1 total number of arguments.
|
|
|
|
#### Description:
|
|
|
|
generates Go code that can parse arbitrary input with the provided syntax, and can be used embedded in an
|
|
application.
|
|
|
|
The syntax may be provided via a file path (using an option or a positional argument), an inline string, or
|
|
piped from standard input.
|
|
|
|
#### Options:
|
|
|
|
- --export bool: determines whether the generated parse function is exported (visible outside its package).
|
|
- --package-name string: specifies the package name for the generated code. Defaults to main.
|
|
- --syntax string: specifies the filename of the syntax definition file.
|
|
- --syntax-string string: specifies the syntax as an inline string.
|
|
- --help: Show help.
|
|
|
|
### treerack format
|
|
|
|
#### Synopsis:
|
|
|
|
```
|
|
treerack format [options]... [--] [syntax string]...
|
|
treerack format <subcommand>
|
|
```
|
|
|
|
#### Description:
|
|
|
|
input syntax. Accepts syntax from one or more files, inline syntax string or stdin. Use the --in-place option,
|
|
when formatting files in place, or print the formatted syntax to stdout.
|
|
|
|
#### Options:
|
|
|
|
- --in-place bool:
|
|
- --syntax string \[\*\]:
|
|
- --syntax-string string:
|
|
- --help: Show help.
|
|
|
|
### treerack version
|
|
|
|
Show version.
|
|
|
|
## Environment variables:
|
|
|
|
Every command line option's value can also be provided as an environment variable. Environment variable names
|
|
need to use snake casing like myapp\_foo\_bar\_baz or MYAPP\_FOO\_BAR\_BAZ, or other casing that doesn't include the
|
|
'-' dash character, and they need to be prefixed with the name of the application, as in the base name of the
|
|
command.
|
|
|
|
When both the environment variable and the command line option is defined, the command line option overrides the
|
|
environment variable. Multiple values for the same environment variable can be defined by concatenating the
|
|
values with the ':' separator character. When overriding multiple values with command line options, all the
|
|
environment values of the same field are dropped.
|
|
|
|
### Example environment variable:
|
|
|
|
```
|
|
TREERACK_SYNTAX=42
|
|
```
|