mirror of
https://github.com/httpie/cli.git
synced 2025-06-24 19:41:23 +02:00
Rename --print-others to --history-print.
This commit is contained in:
parent
30eb0c2f26
commit
098257c0be
@ -15,7 +15,7 @@ This project adheres to `Semantic Versioning <http://semver.org/>`_.
|
|||||||
* Added JSON detection with ``--json, -j`` to work around incorrect
|
* Added JSON detection with ``--json, -j`` to work around incorrect
|
||||||
``Content-Type``
|
``Content-Type``
|
||||||
* Added ``--all`` to show intermediate responses such as redirects (with ``--follow``)
|
* Added ``--all`` to show intermediate responses such as redirects (with ``--follow``)
|
||||||
* Added ``--print-others, -P WHAT`` to specify formatting of intermediate responses
|
* Added ``--history-print, -P WHAT`` to specify formatting of intermediate responses
|
||||||
* Added ``--max-redirects=N`` (default 30)
|
* Added ``--max-redirects=N`` (default 30)
|
||||||
* Added ``-A`` as short name for ``--auth-type``
|
* Added ``-A`` as short name for ``--auth-type``
|
||||||
* Added ``-F`` as short name for ``--follow``
|
* Added ``-F`` as short name for ``--follow``
|
||||||
|
@ -852,7 +852,7 @@ authentication is used (``--auth=digest``), etc.
|
|||||||
|
|
||||||
The intermediary requests/response are by default formatted according to
|
The intermediary requests/response are by default formatted according to
|
||||||
``--print, -p`` (and its shortcuts described above). If you'd like to change
|
``--print, -p`` (and its shortcuts described above). If you'd like to change
|
||||||
that, use the **``--print-others, -P``** option. It takes the same
|
that, use the ``--history-print, -P`` option. It takes the same
|
||||||
arguments as ``--print, -p`` but applies to the intermediary requests only.
|
arguments as ``--print, -p`` but applies to the intermediary requests only.
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,8 +298,8 @@ output_options.add_argument(
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
output_options.add_argument(
|
output_options.add_argument(
|
||||||
'--print-others', '-P',
|
'--history-print', '-P',
|
||||||
dest='output_options_others',
|
dest='output_options_history',
|
||||||
metavar='WHAT',
|
metavar='WHAT',
|
||||||
help="""
|
help="""
|
||||||
The same as --print, -p but applies only to intermediary requests/responses
|
The same as --print, -p but applies only to intermediary requests/responses
|
||||||
|
@ -124,7 +124,7 @@ def program(args, env, log_error):
|
|||||||
output_options=(
|
output_options=(
|
||||||
args.output_options
|
args.output_options
|
||||||
if response is final_response
|
if response is final_response
|
||||||
else args.output_options_others
|
else args.output_options_history
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
# NOTE: `env.stdout` will in fact be `stderr` with `--download`
|
# NOTE: `env.stdout` will in fact be `stderr` with `--download`
|
||||||
|
@ -380,11 +380,11 @@ class HTTPieArgumentParser(ArgumentParser):
|
|||||||
else OUTPUT_OPTIONS_DEFAULT_STDOUT_REDIRECTED
|
else OUTPUT_OPTIONS_DEFAULT_STDOUT_REDIRECTED
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.args.output_options_others is None:
|
if self.args.output_options_history is None:
|
||||||
self.args.output_options_others = self.args.output_options
|
self.args.output_options_history = self.args.output_options
|
||||||
|
|
||||||
check_options(self.args.output_options, '--print')
|
check_options(self.args.output_options, '--print')
|
||||||
check_options(self.args.output_options_others, '--print-others')
|
check_options(self.args.output_options_history, '--history-print')
|
||||||
|
|
||||||
if self.args.download and OUT_RESP_BODY in self.args.output_options:
|
if self.args.download and OUT_RESP_BODY in self.args.output_options:
|
||||||
# Response body is always downloaded with --download and it goes
|
# Response body is always downloaded with --download and it goes
|
||||||
|
@ -34,7 +34,7 @@ def test_follow_redirect_output_options(httpbin):
|
|||||||
'--follow',
|
'--follow',
|
||||||
'--all',
|
'--all',
|
||||||
'--print=h',
|
'--print=h',
|
||||||
'--print-others=H',
|
'--history-print=H',
|
||||||
httpbin.url + '/redirect/2')
|
httpbin.url + '/redirect/2')
|
||||||
assert r.count('GET /') == 2
|
assert r.count('GET /') == 2
|
||||||
assert 'HTTP/1.1 302 FOUND' not in r
|
assert 'HTTP/1.1 302 FOUND' not in r
|
||||||
|
Loading…
x
Reference in New Issue
Block a user