mike-lischke / antlr-format

A tool to format ANTLR grammars
MIT License
8 stars 2 forks source link

Add `--check` option to check if a file isn't formatted properly, without actually writing to the file #5

Open NikitaShkaruba opened 8 months ago

NikitaShkaruba commented 8 months ago

It can be useful in CI/CD. Currently if I run --help, there is no such option

$ antlr-format -h
Usage: antlr-format [options] <file1, pattern2, ...>

Arguments:
  file1, pattern2,             A list of files or glob patterns for multiple files.

Options:
  -a, --add-options [boolean]  Insert the used ANTLR grammar formatting options to the grammar file, if it contains no options. (default: true)
  -c, --config <path>          Path to a JSON file containing the formatting options to use.
  -s, --silent                 Suppress all output except errors.
  -v, --verbose                Print additional information.
  -V, --version                output the version number
  -h, --help                   display help for command

Example of such option in prettier: https://github.com/prettier/prettier/blob/main/docs/cli.md#--check

mike-lischke commented 8 months ago

Nice idea.