From 0d1f9e9feeef299dda601e9c878001242c224778 Mon Sep 17 00:00:00 2001 From: Victorsitou <67214928+Victorsitou@users.noreply.github.com> Date: Tue, 18 Jan 2022 00:48:13 -0300 Subject: [PATCH] Rename to `--no-new-line` --- pre_commit_hooks/.json | 3 +++ pre_commit_hooks/pretty_format_json.py | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 pre_commit_hooks/.json diff --git a/pre_commit_hooks/.json b/pre_commit_hooks/.json new file mode 100644 index 0000000..00c0340 --- /dev/null +++ b/pre_commit_hooks/.json @@ -0,0 +1,3 @@ +{ + "name": "victor" +} \ No newline at end of file diff --git a/pre_commit_hooks/pretty_format_json.py b/pre_commit_hooks/pretty_format_json.py index fbb0889..c87e296 100644 --- a/pre_commit_hooks/pretty_format_json.py +++ b/pre_commit_hooks/pretty_format_json.py @@ -98,11 +98,11 @@ def main(argv: Sequence[str] | None = None) -> int: help='Ordered list of keys to keep at the top of JSON hashes', ) parser.add_argument( - '--new-line', + '--no-new-line', action='store_true', - dest='new_line', + dest='no_new_line', default=False, - help="Add a new line at the end of the file" + help="Do NOT add a new line at the end of the files" ) parser.add_argument('filenames', nargs='*', help='Filenames to fix') args = parser.parse_args(argv) @@ -116,7 +116,7 @@ def main(argv: Sequence[str] | None = None) -> int: try: pretty_contents = _get_pretty_format( contents, args.indent, ensure_ascii=not args.no_ensure_ascii, - sort_keys=not args.no_sort_keys, top_keys=args.top_keys, new_line=args.new_line + sort_keys=not args.no_sort_keys, top_keys=args.top_keys, new_line=not args.no_new_line ) except ValueError: print(