mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-29 10:16:52 +00:00
python 3.6 reached end of life on 2021-12-23 Committed via https://github.com/asottile/all-repos
25 lines
577 B
Python
25 lines
577 B
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
from typing import Sequence
|
|
|
|
import toml
|
|
|
|
|
|
def main(argv: Sequence[str] | None = None) -> int:
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('filenames', nargs='*', help='Filenames to check.')
|
|
args = parser.parse_args(argv)
|
|
|
|
retval = 0
|
|
for filename in args.filenames:
|
|
try:
|
|
toml.load(filename)
|
|
except toml.TomlDecodeError as exc:
|
|
print(f'{filename}: {exc}')
|
|
retval = 1
|
|
return retval
|
|
|
|
|
|
if __name__ == '__main__':
|
|
raise SystemExit(main())
|