mirror of
https://github.com/httpie/cli.git
synced 2024-11-24 08:22:22 +02:00
fixed issues related to downloading and using quiet at the same time
This commit is contained in:
parent
ae22d4e754
commit
c90d039a0b
@ -1158,6 +1158,10 @@ be printed via several options:
|
||||
``--print, -p`` Selects parts of the HTTP exchange.
|
||||
``--quiet, -q`` Doesn't print anything. Overrides other output flags.
|
||||
================= =====================================================
|
||||
If ``--quiet`` is used in conjuction with ``--output`` the flag is ignored
|
||||
and ``stdout`` is still redirected. If ``--quiet`` is used with ``--download``
|
||||
file is still downloaded as usual but ``stdout`` and ``stdin`` are redirected
|
||||
to ``devnull``.
|
||||
|
||||
``--verbose`` can often be useful for debugging the request and generating
|
||||
documentation examples:
|
||||
|
@ -148,6 +148,7 @@ class HTTPieArgumentParser(argparse.ArgumentParser):
|
||||
# The response body will be treated separately.
|
||||
self.env.stdout = self.env.stderr
|
||||
self.env.stdout_isatty = self.env.stderr_isatty
|
||||
|
||||
elif self.args.output_file:
|
||||
# When not `--download`ing, then `--output` simply replaces
|
||||
# `stdout`. The file is opened for appending, which isn't what
|
||||
@ -165,8 +166,9 @@ class HTTPieArgumentParser(argparse.ArgumentParser):
|
||||
self.env.stdout_isatty = False
|
||||
|
||||
if self.args.quiet:
|
||||
self.env.stdout = self.env.devnull
|
||||
self.env.stderr = self.env.devnull
|
||||
if not (self.args.output_file_specified and not self.args.download):
|
||||
self.env.stdout = self.env.devnull
|
||||
|
||||
def _process_auth(self):
|
||||
# TODO: refactor & simplify this method.
|
||||
|
@ -432,7 +432,8 @@ output_options.add_argument(
|
||||
default=False,
|
||||
help='''
|
||||
Do not print to stdout or stderr.
|
||||
|
||||
stdout is still redirected if --output is specified.
|
||||
Flag doesn't affect behaviour of download beyond not printing to terminal.
|
||||
'''
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user