Usage

Command Line

Reformat code snippets in the given reStructuredText files.

snippet-fmt [OPTIONS] [FILENAME]...

Options

-c, --config-file <config_file>

The path to the TOML configuration file to use.

Default

pyproject.toml

-e, --exclude <PATTERN>

Patterns for files to exclude from formatting.

-v, --verbose

Show verbose output.

--colour, --no-colour

Whether to use coloured output.

-T, --traceback

Show the complete traceback on error.

--diff

Show a diff of changes made

Arguments

FILENAME

Optional argument(s). Default None

As a pre-commit hook

snippet-fmt can also be used as a pre-commit hook. To do so, add the following to your .pre-commit-config.yaml file:

- repo: https://github.com/python-formate/snippet-fmt
  rev: 0.1.5
  hooks:
  - id: snippet-fmt
    args:
    - --verbose

The args option can be used to provide the command line arguments shown above. By default snippet-fmt is run with --verbose --diff