mirror of
https://github.com/httpie/cli.git
synced 2025-06-20 17:47:48 +02:00
Include data directory location with --debug.
This commit is contained in:
parent
9b586b953b
commit
50810e5bd9
@ -240,7 +240,8 @@ parser.add_argument(
|
|||||||
'--debug', action='store_true', default=False,
|
'--debug', action='store_true', default=False,
|
||||||
help=_('''
|
help=_('''
|
||||||
Prints exception traceback should one occur, and also other
|
Prints exception traceback should one occur, and also other
|
||||||
information useful for debugging HTTPie itself and bug reports.
|
information that is useful for debugging HTTPie itself and
|
||||||
|
for bug reports.
|
||||||
''')
|
''')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@ from .cli import parser
|
|||||||
from .client import get_response
|
from .client import get_response
|
||||||
from .models import Environment
|
from .models import Environment
|
||||||
from .output import output_stream, write, write_with_colors_win_p3k
|
from .output import output_stream, write, write_with_colors_win_p3k
|
||||||
|
from .config import CONFIG_DIR
|
||||||
from . import EXIT
|
from . import EXIT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_exist_status(code, allow_redirects=False):
|
def get_exist_status(code, allow_redirects=False):
|
||||||
"""Translate HTTP status code to exit status."""
|
"""Translate HTTP status code to exit status."""
|
||||||
if 300 <= code <= 399 and not allow_redirects:
|
if 300 <= code <= 399 and not allow_redirects:
|
||||||
@ -42,6 +42,16 @@ def get_exist_status(code, allow_redirects=False):
|
|||||||
return EXIT.OK
|
return EXIT.OK
|
||||||
|
|
||||||
|
|
||||||
|
def print_debug_info():
|
||||||
|
sys.stderr.writelines([
|
||||||
|
'HTTPie %s\n' % httpie_version,
|
||||||
|
'HTTPie data: %s\n' % CONFIG_DIR,
|
||||||
|
'Requests %s\n' % requests_version,
|
||||||
|
'Pygments %s\n' % pygments_version,
|
||||||
|
'Python %s %s\n' % (sys.version, sys.platform)
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
def main(args=sys.argv[1:], env=Environment()):
|
def main(args=sys.argv[1:], env=Environment()):
|
||||||
"""Run the main program and write the output to ``env.stdout``.
|
"""Run the main program and write the output to ``env.stdout``.
|
||||||
|
|
||||||
@ -58,10 +68,9 @@ def main(args=sys.argv[1:], env=Environment()):
|
|||||||
status = EXIT.OK
|
status = EXIT.OK
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
sys.stderr.write('HTTPie %s\n' % httpie_version)
|
print_debug_info()
|
||||||
sys.stderr.write('Requests %s\n' % requests_version)
|
if args == ['--debug']:
|
||||||
sys.stderr.write('Pygments %s\n' % pygments_version)
|
sys.exit(EXIT.OK)
|
||||||
sys.stderr.write('Python %s %s\n' % (sys.version, sys.platform))
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
args = parser.parse_args(args=args, env=env)
|
args = parser.parse_args(args=args, env=env)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user