diff --git a/README.rst b/README.rst index 9a03b3e8..13cc71b9 100644 --- a/README.rst +++ b/README.rst @@ -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: diff --git a/httpie/cli/argparser.py b/httpie/cli/argparser.py index 2c52fc54..ddcfb79c 100644 --- a/httpie/cli/argparser.py +++ b/httpie/cli/argparser.py @@ -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. diff --git a/httpie/cli/definition.py b/httpie/cli/definition.py index 3eb483ca..764c6c05 100644 --- a/httpie/cli/definition.py +++ b/httpie/cli/definition.py @@ -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. ''' )