◐ Shell
clean mode source ↗

bpo-29636: json.tool: Add document for indentation options. by dhimmel · Pull Request #17482 · python/cpython

Conversation

@dhimmel

#345 added indentation options for the json.tool command line utility. This PR follows up with some additional modifications that I didn't have time to put in the previous PR before it was merged.

https://bugs.python.org/issue29636

CC @methane

dhimmel

Mutually exclusive options for whitespace control

.. versionadded:: 3.9

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wimglenn does this documentation look okay? I combined multiple arguments into a single line (not sure if that violates convention or is okay)

dhimmel

parser.add_argument('--json-lines', action='store_true', default=False,
help='parse input using the jsonlines format')
help='parse input using the jsonlines format. '
'Use with --no-indent or --compact to produce valid jsonlines output.')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hongweipeng (author of #10051): do you think this is a worthwhile and accurate addition to the documentation now that indentation options are supported?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks.

trailing newlines were previously ignored due to .splitlines
Probably is better to test for this to ensure any future
change in behavior is intentional.

@methane methane changed the title bpo-29636: touch ups to json.tool indentation options bpo-29636: json.tool: Add document for indentation options.

Dec 6, 2019

methane

@dhimmel

shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request

Jan 31, 2020
…-17482)

And updated test to use subprocess.run

Labels