1
0
mirror of https://github.com/httpie/cli.git synced 2025-08-10 22:42:05 +02:00

Use : instead of = in `--format-options

This commit is contained in:
Jakub Roztocil
2020-05-28 12:26:06 +02:00
parent aae596d472
commit caeef2fb7c
6 changed files with 19 additions and 18 deletions

View File

@@ -190,7 +190,7 @@ def parse_format_options(s: str, defaults: Optional[dict]) -> dict:
>>> parse_format_options(
... defaults={'json': {'indent': 4, 'sort_keys': True}},
... s='json.indent=2,json.sort_keys=False',
... s='json.indent:2,json.sort_keys:False',
... )
{'json': {'indent': 2, 'sort_keys': False}}
@@ -202,7 +202,7 @@ def parse_format_options(s: str, defaults: Optional[dict]) -> dict:
options = deepcopy(defaults or {})
for option in s.split(','):
try:
path, value = option.lower().split('=')
path, value = option.lower().split(':')
section, key = path.split('.')
except ValueError:
raise argparse.ArgumentTypeError(f'invalid option {option!r}')

View File

@@ -85,10 +85,10 @@ PRETTY_STDOUT_TTY_ONLY = object()
DEFAULT_FORMAT_OPTIONS = [
'headers.sort=true',
'json.format=true',
'json.indent=4',
'json.sort_keys=true',
'headers.sort:true',
'json.format:true',
'json.indent:4',
'json.sort_keys:true',
]

View File

@@ -246,7 +246,7 @@ output_processing.add_argument(
You can specify multiple comma-separated options. For example, this modifies
the settings to disable the sorting of JSON keys and headers:
--format-options json.sort_keys=false,headers.sort=false
--format-options json.sort_keys:false,headers.sort:false
This is something you will typically put into your config file.