1
0
treerack/cmd/treerack
2026-06-06 21:48:50 +02:00
..
bar_test.txt add check command 2018-01-08 23:07:05 +01:00
baz_test.treerack format command line command 2026-06-02 00:04:03 +02:00
check_test.go error fixes and doc updates 2026-01-21 20:54:16 +01:00
check.go only use tracing when explicitly enabled 2026-06-06 21:48:50 +02:00
checksyntax_test.go error fixes and doc updates 2026-01-21 20:54:16 +01:00
checksyntax.go only use tracing when explicitly enabled 2026-06-06 21:48:50 +02:00
docreflect.gen.go only use tracing when explicitly enabled 2026-06-06 21:48:50 +02:00
foo_test.treerack formatter script for local syntax files 2026-06-01 21:29:33 +02:00
format_test.go format command line command 2026-06-02 00:04:03 +02:00
format.go only use tracing when explicitly enabled 2026-06-06 21:48:50 +02:00
generate_test.go error fixes and doc updates 2026-01-21 20:54:16 +01:00
generate.go only use tracing when explicitly enabled 2026-06-06 21:48:50 +02:00
input.go error fixes and doc updates 2026-01-21 20:54:16 +01:00
main.go format command line command 2026-06-02 00:04:03 +02:00
readme.md only use tracing when explicitly enabled 2026-06-06 21:48:50 +02:00
show_test.go error fixes and doc updates 2026-01-21 20:54:16 +01:00
show.go only use tracing when explicitly enabled 2026-06-06 21:48:50 +02:00

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:

  • --max-trace-length int: enables tracing when set to a positive integer.
  • --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.
  • --max-trace-length int: enables tracing when set to a positive integer.
  • --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.
  • --max-trace-length int: enables tracing when set to a positive integer.
  • --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).
  • --max-trace-length int: enables tracing when set to a positive integer.
  • --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: specifies if an input file should be formatted in-place instead of printing the formatted results to the standard output.
  • --max-trace-length int: enables tracing when set to a positive integer.
  • --syntax string [*]: specifies the filename of the syntax definition file.
  • --syntax-string string: specifies the syntax as an inline 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