You've already forked httpie-cli
mirror of
https://github.com/httpie/cli.git
synced 2026-06-20 11:32:56 +02:00
Added a quiet functionality
This commit is contained in:
committed by
Jakub Roztocil
parent
ebf2139fd5
commit
a4a1e8d43b
@@ -135,10 +135,16 @@ class HTTPieArgumentParser(argparse.ArgumentParser):
|
||||
Modify `env.stdout` and `env.stdout_isatty` based on args, if needed.
|
||||
|
||||
"""
|
||||
if self.args.quiet:
|
||||
self.env.stdout = self.env.devnull
|
||||
self.env.stdout_isatty = self.env.devnull_isatty
|
||||
self.env.stderr = self.env.devnull
|
||||
self.env.stderr_isatty = self.env.devnull_isatty
|
||||
|
||||
self.args.output_file_specified = bool(self.args.output_file)
|
||||
if self.args.download:
|
||||
# FIXME: Come up with a cleaner solution.
|
||||
if not self.args.output_file and not self.env.stdout_isatty:
|
||||
if not self.args.output_file and not self.env.stdout_isatty and not self.args.quiet:
|
||||
# Use stdout as the download output file.
|
||||
self.args.output_file = self.env.stdout
|
||||
# With `--download`, we write everything that would normally go to
|
||||
|
||||
@@ -426,6 +426,16 @@ output_options.add_argument(
|
||||
'''
|
||||
)
|
||||
|
||||
output_options.add_argument(
|
||||
'--quiet', '-q',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='''
|
||||
Do not print to stdout or stderr.
|
||||
|
||||
'''
|
||||
)
|
||||
|
||||
#######################################################################
|
||||
# Sessions
|
||||
#######################################################################
|
||||
|
||||
Reference in New Issue
Block a user