DEV Community

Matthew McGarvey
Matthew McGarvey

Posted on

Crystal Spec CLI Gotcha (--help)

When calling crystal spec --help you actually get the spec description but the options list of the crystal CLI instead of the specs.

❯ crystal spec --help
Usage: crystal spec [options] [files]

Options:
    -d, --debug                      Add full symbolic debug info
    --no-debug                       Skip any symbolic debug info
    -D FLAG, --define FLAG           Define a compile-time flag
    --error-trace                    Show full error trace
    --release                        Compile in release mode
    -s, --stats                      Enable statistics output
    -p, --progress                   Enable progress output
    -t, --time                       Enable execution time output
    -h, --help                       Show this message
    --no-color                       Disable colored output
    --warnings all|none              Which warnings detect. (default: all)
    --error-on-warnings              Treat warnings as errors.
    --exclude-warnings <path>        Exclude warnings from path (default: lib)
Enter fullscreen mode Exit fullscreen mode

To get the options list for specs, run crystal spec -- --help.

❯ crystal spec -- --help
crystal spec runner
    -e , --example STRING            run examples whose full nested names include STRING
    -l , --line LINE                 run examples whose line matches LINE
    -p, --profile                    Print the 10 slowest specs
    --fail-fast                      abort the run on first failure
    --location file:line             run example at line 'line' in file 'file', multiple allowed
    --tag TAG                        run examples with the specified TAG, or exclude examples by adding ~ before the TAG.
    --order MODE                     run examples in random order by passing MODE as 'random' or to a specific seed by passing MODE as the seed value
    --junit_output OUTPUT_PATH       generate JUnit XML output within the given OUTPUT_PATH
    -h, --help                       show this help
    -v, --verbose                    verbose output
    --tap                            Generate TAP output (Test Anything Protocol)
    --no-color                       Disable colored output
Enter fullscreen mode Exit fullscreen mode

Maybe this was obvious to everyone but I had no idea until I was told about it.

Top comments (1)

Collapse
 
dinkopehar profile image
Dinko Pehar

You could also build a spec with crystal build path_to_spec and then run ./binary --help . You would agent same output.