codekingpro/portable-devtools
114k
1from __future__ import annotations2 3import os4import textwrap5from argparse import FileType6 7from httpie import __doc__, __version__8from httpie.cli.argtypes import (KeyValueArgType, SessionNameValidator,9 SSLCredentials, readable_file_arg,10 response_charset_type, response_mime_type)11from httpie.cli.constants import (BASE_OUTPUT_OPTIONS, DEFAULT_FORMAT_OPTIONS,12 OUT_REQ_BODY, OUT_REQ_HEAD, OUT_RESP_BODY,13 OUT_RESP_HEAD, OUT_RESP_META, OUTPUT_OPTIONS,14 OUTPUT_OPTIONS_DEFAULT, PRETTY_MAP,15 PRETTY_STDOUT_TTY_ONLY,16 SEPARATOR_GROUP_ALL_ITEMS, SEPARATOR_PROXY,17 SORTED_FORMAT_OPTIONS_STRING,18 UNSORTED_FORMAT_OPTIONS_STRING, RequestType)19from httpie.cli.options import ParserSpec, Qualifiers, to_argparse20from httpie.output.formatters.colors import (AUTO_STYLE, DEFAULT_STYLE, BUNDLED_STYLES,21 get_available_styles)22from httpie.plugins.builtin import BuiltinAuthPlugin23from httpie.plugins.registry import plugin_manager24from httpie.ssl_ import AVAILABLE_SSL_VERSION_ARG_MAPPING, DEFAULT_SSL_CIPHERS_STRING25 26 27# Man pages are static (built when making a release).28# We use this check to not include generated, system-specific information there (e.g., default --ciphers).29IS_MAN_PAGE = bool(os.environ.get('HTTPIE_BUILDING_MAN_PAGES'))30 31 32options = ParserSpec(33 'http',34 description=f'{__doc__.strip()} <https://httpie.io>',35 epilog="""36 For every --OPTION there is also a --no-OPTION that reverts OPTION37 to its default value.38 39 Suggestions and bug reports are greatly appreciated:40 https://github.com/httpie/cli/issues41 """,42 source_file=__file__43)44 45#######################################################################46# Positional arguments.47#######################################################################48 49positional_arguments = options.add_group(50 'Positional arguments',51 description="""52 These arguments come after any flags and in the order they are listed here.53 Only URL is required.54 """,55)56 57positional_arguments.add_argument(58 dest='method',59 metavar='METHOD',60 nargs=Qualifiers.OPTIONAL,61 default=None,62 short_help='The HTTP method to be used for the request (GET, POST, PUT, DELETE, ...).',63 help="""64 The HTTP method to be used for the request (GET, POST, PUT, DELETE, ...).65 66 This argument can be omitted in which case HTTPie will use POST if there67 is some data to be sent, otherwise GET:68 69 $ http example.org # => GET70 $ http example.org hello=world # => POST71 72 """,73)74positional_arguments.add_argument(75 dest='url',76 metavar='URL',77 short_help='The request URL.',78 help="""79 The request URL. Scheme defaults to 'http://' if the URL80 does not include one. (You can override this with: --default-scheme=http/https)81 82 You can also use a shorthand for localhost83 84 $ http :3000 # => http://localhost:300085 $ http :/foo # => http://localhost/foo86 87 """,88)89positional_arguments.add_argument(90 dest='request_items',91 metavar='REQUEST_ITEM',92 nargs=Qualifiers.ZERO_OR_MORE,93 default=None,94 type=KeyValueArgType(*SEPARATOR_GROUP_ALL_ITEMS),95 short_help=(96 'HTTPie’s request items syntax for specifying HTTP headers, JSON/Form'97 'data, files, and URL parameters.'98 ),99 nested_options=[100 ('HTTP Headers', 'Name:Value', 'Arbitrary HTTP header, e.g X-API-Token:123'),101 ('URL Parameters', 'name==value', 'Querystring parameter to the URL, e.g limit==50'),102 ('Data Fields', 'field=value', 'Data fields to be serialized as JSON (default) or Form Data (with --form)'),103 ('Raw JSON Fields', 'field:=json', 'Data field for real JSON types.'),104 ('File upload Fields', 'field@/dir/file', 'Path field for uploading a file.'),105 ],106 help=r"""107 Optional key-value pairs to be included in the request. The separator used108 determines the type:109 110 ':' HTTP headers:111 112 Referer:https://httpie.io Cookie:foo=bar User-Agent:bacon/1.0113 114 '==' URL parameters to be appended to the request URI:115 116 search==httpie117 118 '=' Data fields to be serialized into a JSON object (with --json, -j)119 or form data (with --form, -f):120 121 name=HTTPie language=Python description='CLI HTTP client'122 123 ':=' Non-string JSON data fields (only with --json, -j):124 125 awesome:=true amount:=42 colors:='["red", "green", "blue"]'126 127 '@' Form file fields (only with --form or --multipart):128 129 cv@~/Documents/CV.pdf130 cv@'~/Documents/CV.pdf;type=application/pdf'131 132 '=@' A data field like '=', but takes a file path and embeds its content:133 134 essay=@Documents/essay.txt135 136 ':=@' A raw JSON field like ':=', but takes a file path and embeds its content:137 138 package:=@./package.json139 140 You can use a backslash to escape a colliding separator in the field name:141 142 field-name-with\:colon=value143 144 """,145)146 147#######################################################################148# Content type.149#######################################################################150 151content_types = options.add_group('Predefined content types')152 153content_types.add_argument(154 '--json',155 '-j',156 action='store_const',157 const=RequestType.JSON,158 dest='request_type',159 short_help='(default) Serialize data items from the command line as a JSON object.',160 help="""161 (default) Data items from the command line are serialized as a JSON object.162 The Content-Type and Accept headers are set to application/json163 (if not specified).164 165 """,166)167content_types.add_argument(168 '--form',169 '-f',170 action='store_const',171 const=RequestType.FORM,172 dest='request_type',173 short_help='Serialize data items from the command line as form field data.',174 help="""175 Data items from the command line are serialized as form fields.176 177 The Content-Type is set to application/x-www-form-urlencoded (if not178 specified). The presence of any file fields results in a179 multipart/form-data request.180 181 """,182)183content_types.add_argument(184 '--multipart',185 action='store_const',186 const=RequestType.MULTIPART,187 dest='request_type',188 short_help=(189 'Similar to --form, but always sends a multipart/form-data '190 'request (i.e., even without files).'191 )192)193content_types.add_argument(194 '--boundary',195 short_help=(196 'Specify a custom boundary string for multipart/form-data requests. '197 'Only has effect only together with --form.'198 )199)200content_types.add_argument(201 '--raw',202 short_help='Pass raw request data without extra processing.',203 help="""204 This option allows you to pass raw request data without extra processing205 (as opposed to the structured request items syntax):206 207 $ http --raw='data' pie.dev/post208 209 You can achieve the same by piping the data via stdin:210 211 $ echo data | http pie.dev/post212 213 Or have HTTPie load the raw data from a file:214 215 $ http pie.dev/post @data.txt216 217 218 """,219)220 221#######################################################################222# Content processing.223#######################################################################224 225processing_options = options.add_group('Content processing options')226 227processing_options.add_argument(228 '--compress',229 '-x',230 action='count',231 default=0,232 short_help='Compress the content with Deflate algorithm.',233 help="""234 Content compressed (encoded) with Deflate algorithm.235 The Content-Encoding header is set to deflate.236 237 Compression is skipped if it appears that compression ratio is238 negative. Compression can be forced by repeating the argument.239 240 """,241)242 243 244#######################################################################245# Output processing246#######################################################################247 248 249def format_style_help(available_styles, *, isolation_mode: bool = False):250 text = """251 Output coloring style (default is "{default}"). It can be one of:252 253 {available_styles}254 """255 if isolation_mode:256 text += '\n\n'257 text += 'For finding out all available styles in your system, try:\n\n'258 text += ' $ http --style\n'259 text += textwrap.dedent("""260 The "{auto_style}" style follows your terminal's ANSI color styles.261 For non-{auto_style} styles to work properly, please make sure that the262 $TERM environment variable is set to "xterm-256color" or similar263 (e.g., via `export TERM=xterm-256color' in your ~/.bashrc).264 """)265 266 if isolation_mode:267 available_styles = sorted(BUNDLED_STYLES)268 269 available_styles_text = '\n'.join(270 f' {line.strip()}'271 for line in textwrap.wrap(', '.join(available_styles), 60)272 ).strip()273 return text.format(274 default=DEFAULT_STYLE,275 available_styles=available_styles_text,276 auto_style=AUTO_STYLE,277 )278 279 280_sorted_kwargs = {281 'action': 'append_const',282 'const': SORTED_FORMAT_OPTIONS_STRING,283 'dest': 'format_options',284}285_unsorted_kwargs = {286 'action': 'append_const',287 'const': UNSORTED_FORMAT_OPTIONS_STRING,288 'dest': 'format_options',289}290 291output_processing = options.add_group('Output processing')292 293output_processing.add_argument(294 '--pretty',295 dest='prettify',296 default=PRETTY_STDOUT_TTY_ONLY,297 choices=sorted(PRETTY_MAP.keys()),298 short_help='Control the processing of console outputs.',299 help="""300 Controls output processing. The value can be "none" to not prettify301 the output (default for redirected output), "all" to apply both colors302 and formatting (default for terminal output), "colors", or "format".303 304 """,305)306output_processing.add_argument(307 '--style',308 '-s',309 dest='style',310 metavar='STYLE',311 default=DEFAULT_STYLE,312 action='lazy_choices',313 getter=get_available_styles,314 short_help=f'Output coloring style (default is "{DEFAULT_STYLE}").',315 help_formatter=format_style_help,316)317 318# The closest approx. of the documented resetting to default via --no-<option>.319# We hide them from the doc because they act only as low-level aliases here.320output_processing.add_argument(321 '--no-unsorted', **_sorted_kwargs, help=Qualifiers.SUPPRESS322)323output_processing.add_argument(324 '--no-sorted', **_unsorted_kwargs, help=Qualifiers.SUPPRESS325)326 327output_processing.add_argument(328 '--unsorted',329 **_unsorted_kwargs,330 short_help='Disables all sorting while formatting output.',331 help=f"""332 Disables all sorting while formatting output. It is a shortcut for:333 334 --format-options={UNSORTED_FORMAT_OPTIONS_STRING}335 336 """,337)338output_processing.add_argument(339 '--sorted',340 **_sorted_kwargs,341 short_help='Re-enables all sorting options while formatting output.',342 help=f"""343 Re-enables all sorting options while formatting output. It is a shortcut for:344 345 --format-options={SORTED_FORMAT_OPTIONS_STRING}346 347 """,348)349output_processing.add_argument(350 '--response-charset',351 metavar='ENCODING',352 type=response_charset_type,353 short_help='Override the response encoding for terminal display purposes.',354 help="""355 Override the response encoding for terminal display purposes, e.g.:356 357 --response-charset=utf8358 --response-charset=big5359 360 """,361)362output_processing.add_argument(363 '--response-mime',364 metavar='MIME_TYPE',365 type=response_mime_type,366 short_help='Override the response mime type for coloring and formatting for the terminal.',367 help="""368 Override the response mime type for coloring and formatting for the terminal, e.g.:369 370 --response-mime=application/json371 --response-mime=text/xml372 373 """,374)375output_processing.add_argument(376 '--format-options',377 action='append',378 short_help='Controls output formatting.',379 help="""380 Controls output formatting. Only relevant when formatting is enabled381 through (explicit or implied) --pretty=all or --pretty=format.382 The following are the default options:383 384 {option_list}385 386 You may use this option multiple times, as well as specify multiple387 comma-separated options at the same time. For example, this modifies the388 settings to disable the sorting of JSON keys, and sets the indent size to 2:389 390 --format-options json.sort_keys:false,json.indent:2391 392 This is something you will typically put into your config file.393 394 """.format(395 option_list='\n'.join(396 f' {option}' for option in DEFAULT_FORMAT_OPTIONS397 ).strip()398 ),399)400 401#######################################################################402# Output options403#######################################################################404 405output_options = options.add_group('Output options')406 407output_options.add_argument(408 '--print',409 '-p',410 dest='output_options',411 metavar='WHAT',412 short_help='Options to specify what the console output should contain.',413 help=f"""414 String specifying what the output should contain:415 416 '{OUT_REQ_HEAD}' request headers417 '{OUT_REQ_BODY}' request body418 '{OUT_RESP_HEAD}' response headers419 '{OUT_RESP_BODY}' response body420 '{OUT_RESP_META}' response metadata421 422 The default behaviour is '{OUTPUT_OPTIONS_DEFAULT}' (i.e., the response423 headers and body is printed), if standard output is not redirected.424 If the output is piped to another program or to a file, then only the425 response body is printed by default.426 427 """,428)429output_options.add_argument(430 '--headers',431 '-h',432 dest='output_options',433 action='store_const',434 const=OUT_RESP_HEAD,435 short_help='Print only the response headers.',436 help=f"""437 Print only the response headers. Shortcut for --print={OUT_RESP_HEAD}.438 439 """,440)441output_options.add_argument(442 '--meta',443 '-m',444 dest='output_options',445 action='store_const',446 const=OUT_RESP_META,447 short_help='Print only the response metadata.',448 help=f"""449 Print only the response metadata. Shortcut for --print={OUT_RESP_META}.450 451 """,452)453output_options.add_argument(454 '--body',455 '-b',456 dest='output_options',457 action='store_const',458 const=OUT_RESP_BODY,459 short_help='Print only the response body.',460 help=f"""461 Print only the response body. Shortcut for --print={OUT_RESP_BODY}.462 463 """,464)465 466output_options.add_argument(467 '--verbose',468 '-v',469 dest='verbose',470 action='count',471 default=0,472 short_help='Make output more verbose.',473 help=f"""474 Verbose output. For the level one (with single `-v`/`--verbose`), print475 the whole request as well as the response. Also print any intermediary476 requests/responses (such as redirects). For the second level and higher,477 print these as well as the response metadata.478 479 Level one is a shortcut for: --all --print={''.join(sorted(BASE_OUTPUT_OPTIONS))}480 Level two is a shortcut for: --all --print={''.join(sorted(OUTPUT_OPTIONS))}481 """,482)483output_options.add_argument(484 '--all',485 default=False,486 action='store_true',487 short_help='Show any intermediary requests/responses.',488 help="""489 By default, only the final request/response is shown. Use this flag to show490 any intermediary requests/responses as well. Intermediary requests include491 followed redirects (with --follow), the first unauthorized request when492 Digest auth is used (--auth=digest), etc.493 494 """,495)496output_options.add_argument(497 '--history-print',498 '-P',499 dest='output_options_history',500 metavar='WHAT',501 help=Qualifiers.SUPPRESS,502)503output_options.add_argument(504 '--stream',505 '-S',506 action='store_true',507 default=False,508 short_help='Always stream the response body by line, i.e., behave like `tail -f`.',509 help="""510 Always stream the response body by line, i.e., behave like `tail -f'.511 512 Without --stream and with --pretty (either set or implied),513 HTTPie fetches the whole response before it outputs the processed data.514 515 Set this option when you want to continuously display a prettified516 long-lived response, such as one from the Twitter streaming API.517 518 It is useful also without --pretty: It ensures that the output is flushed519 more often and in smaller chunks.520 521 """,522)523output_options.add_argument(524 '--output',525 '-o',526 type=FileType('a+b'),527 dest='output_file',528 metavar='FILE',529 short_help='Save output to FILE instead of stdout.',530 help="""531 Save output to FILE instead of stdout. If --download is also set, then only532 the response body is saved to FILE. Other parts of the HTTP exchange are533 printed to stderr.534 535 """,536)537 538output_options.add_argument(539 '--download',540 '-d',541 action='store_true',542 default=False,543 short_help='Download the body to a file instead of printing it to stdout.',544 help="""545 Do not print the response body to stdout. Rather, download it and store it546 in a file. The filename is guessed unless specified with --output547 [filename]. This action is similar to the default behaviour of wget.548 549 """,550)551output_options.add_argument(552 '--continue',553 '-c',554 dest='download_resume',555 action='store_true',556 default=False,557 short_help='Resume an interrupted download (--output needs to be specified).',558 help="""559 Resume an interrupted download. Note that the --output option needs to be560 specified as well.561 562 """,563)564output_options.add_argument(565 '--quiet',566 '-q',567 action='count',568 default=0,569 short_help='Do not print to stdout or stderr, except for errors and warnings when provided once.',570 help="""571 Do not print to stdout or stderr, except for errors and warnings when provided once.572 Provide twice to suppress warnings as well.573 stdout is still redirected if --output is specified.574 Flag doesn't affect behaviour of download beyond not printing to terminal.575 576 """,577)578 579#######################################################################580# Sessions581#######################################################################582 583session_name_validator = SessionNameValidator(584 'Session name contains invalid characters.'585)586 587sessions = options.add_group('Sessions', is_mutually_exclusive=True)588 589sessions.add_argument(590 '--session',591 metavar='SESSION_NAME_OR_PATH',592 type=session_name_validator,593 short_help='Create, or reuse and update a session.',594 help="""595 Create, or reuse and update a session. Within a session, custom headers,596 auth credential, as well as any cookies sent by the server persist between597 requests.598 599 Session files are stored in:600 601 [HTTPIE_CONFIG_DIR]/<HOST>/<SESSION_NAME>.json.602 603 See the following page to find out your default HTTPIE_CONFIG_DIR:604 605 https://httpie.io/docs/cli/config-file-directory606 """,607)608sessions.add_argument(609 '--session-read-only',610 metavar='SESSION_NAME_OR_PATH',611 type=session_name_validator,612 short_help='Create or read a session without updating it',613 help="""614 Create or read a session without updating it form the request/response615 exchange.616 617 """,618)619 620 621#######################################################################622# Authentication623#######################################################################624 625 626def format_auth_help(auth_plugins_mapping, *, isolation_mode: bool = False):627 text = """628 The authentication mechanism to be used. Defaults to "{default}".629 630 {auth_types}631 """632 633 auth_plugins = list(auth_plugins_mapping.values())634 if isolation_mode:635 auth_plugins = [636 auth_plugin637 for auth_plugin in auth_plugins638 if issubclass(auth_plugin, BuiltinAuthPlugin)639 ]640 text += '\n'641 text += 'To see all available auth types on your system, including ones installed via plugins, run:\n\n'642 text += ' $ http --auth-type'643 644 auth_types = '\n\n '.join(645 '"{type}": {name}{package}{description}'.format(646 type=plugin.auth_type,647 name=plugin.name,648 package=(649 ''650 if issubclass(plugin, BuiltinAuthPlugin)651 else f' (provided by {plugin.package_name})'652 ),653 description=(654 ''655 if not plugin.description656 else '\n '657 + ('\n '.join(textwrap.wrap(plugin.description)))658 ),659 )660 for plugin in auth_plugins661 )662 663 return text.format(664 default=auth_plugins[0].auth_type,665 auth_types=auth_types,666 )667 668 669authentication = options.add_group('Authentication')670 671authentication.add_argument(672 '--auth',673 '-a',674 default=None,675 metavar='USER[:PASS] | TOKEN',676 short_help='Credentials for the selected (-A) authentication method.',677 help="""678 For username/password based authentication mechanisms (e.g679 basic auth or digest auth) if only the username is provided680 (-a username), HTTPie will prompt for the password.681 682 """,683)684authentication.add_argument(685 '--auth-type',686 '-A',687 action='lazy_choices',688 default=None,689 getter=plugin_manager.get_auth_plugin_mapping,690 sort=True,691 cache=False,692 short_help='The authentication mechanism to be used.',693 help_formatter=format_auth_help,694)695authentication.add_argument(696 '--ignore-netrc',697 default=False,698 action='store_true',699 short_help='Ignore credentials from .netrc.'700)701 702#######################################################################703# Network704#######################################################################705 706network = options.add_group('Network')707 708network.add_argument(709 '--offline',710 default=False,711 action='store_true',712 short_help='Build the request and print it but don’t actually send it.'713)714network.add_argument(715 '--proxy',716 default=[],717 action='append',718 metavar='PROTOCOL:PROXY_URL',719 type=KeyValueArgType(SEPARATOR_PROXY),720 short_help='String mapping of protocol to the URL of the proxy.',721 help="""722 String mapping protocol to the URL of the proxy723 (e.g. http:http://foo.bar:3128). You can specify multiple proxies with724 different protocols. The environment variables $ALL_PROXY, $HTTP_PROXY,725 and $HTTPS_proxy are supported as well.726 727 """,728)729network.add_argument(730 '--follow',731 '-F',732 default=False,733 action='store_true',734 short_help='Follow 30x Location redirects.'735)736 737network.add_argument(738 '--max-redirects',739 type=int,740 default=30,741 short_help='The maximum number of redirects that should be followed (with --follow).',742 help="""743 By default, requests have a limit of 30 redirects (works with --follow).744 745 """,746)747network.add_argument(748 '--max-headers',749 type=int,750 default=0,751 short_help=(752 'The maximum number of response headers to be read before '753 'giving up (default 0, i.e., no limit).'754 )755)756 757network.add_argument(758 '--timeout',759 type=float,760 default=0,761 metavar='SECONDS',762 short_help='The connection timeout of the request in seconds.',763 help="""764 The connection timeout of the request in seconds.765 The default value is 0, i.e., there is no timeout limit.766 This is not a time limit on the entire response download;767 rather, an error is reported if the server has not issued a response for768 timeout seconds (more precisely, if no bytes have been received on769 the underlying socket for timeout seconds).770 771 """,772)773network.add_argument(774 '--check-status',775 default=False,776 action='store_true',777 short_help='Exit with an error status code if the server replies with an error.',778 help="""779 By default, HTTPie exits with 0 when no network or other fatal errors780 occur. This flag instructs HTTPie to also check the HTTP status code and781 exit with an error if the status indicates one.782 783 When the server replies with a 4xx (Client Error) or 5xx (Server Error)784 status code, HTTPie exits with 4 or 5 respectively. If the response is a785 3xx (Redirect) and --follow hasn't been set, then the exit status is 3.786 Also an error message is written to stderr if stdout is redirected.787 788 """,789)790network.add_argument(791 '--path-as-is',792 default=False,793 action='store_true',794 short_help='Bypass dot segment (/../ or /./) URL squashing.'795)796network.add_argument(797 '--chunked',798 default=False,799 action='store_true',800 short_help=(801 'Enable streaming via chunked transfer encoding. '802 'The Transfer-Encoding header is set to chunked.'803 )804)805 806#######################################################################807# SSL808#######################################################################809 810ssl = options.add_group('SSL')811 812ssl.add_argument(813 '--verify',814 default='yes',815 short_help='If "no", skip SSL verification. If a file path, use it as a CA bundle.',816 help="""817 Set to "no" (or "false") to skip checking the host's SSL certificate.818 Defaults to "yes" ("true"). You can also pass the path to a CA_BUNDLE file819 for private certs. (Or you can set the REQUESTS_CA_BUNDLE environment820 variable instead.)821 """,822)823ssl.add_argument(824 '--ssl',825 dest='ssl_version',826 choices=sorted(AVAILABLE_SSL_VERSION_ARG_MAPPING.keys()),827 short_help='The desired protocol version to used.',828 help="""829 The desired protocol version to use. This will default to830 SSL v2.3 which will negotiate the highest protocol that both831 the server and your installation of OpenSSL support. Available protocols832 may vary depending on OpenSSL installation (only the supported ones833 are shown here).834 835 """,836)837 838CIPHERS_CURRENT_DEFAULTS = (839 """840 See `http --help` for the default ciphers list on you system.841 842 """843 if IS_MAN_PAGE else844 f"""845 By default, the following ciphers are used on your system:846 847 {DEFAULT_SSL_CIPHERS_STRING}848 849 """850)851ssl.add_argument(852 '--ciphers',853 short_help='A string in the OpenSSL cipher list format.',854 help=f"""855 856 A string in the OpenSSL cipher list format.857 858 {CIPHERS_CURRENT_DEFAULTS}859 860 """861)862ssl.add_argument(863 '--cert',864 default=None,865 type=readable_file_arg,866 short_help='Specifies a local cert to use as the client-side SSL certificate.',867 help="""868 You can specify a local cert to use as client side SSL certificate.869 This file may either contain both private key and certificate or you may870 specify --cert-key separately.871 872 """,873)874ssl.add_argument(875 '--cert-key',876 default=None,877 type=readable_file_arg,878 short_help='The private key to use with SSL. Only needed if --cert is given.',879 help="""880 The private key to use with SSL. Only needed if --cert is given and the881 certificate file does not contain the private key.882 883 """,884)885 886ssl.add_argument(887 '--cert-key-pass',888 default=None,889 type=SSLCredentials,890 short_help='The passphrase to be used to with the given private key.',891 help="""892 The passphrase to be used to with the given private key. Only needed if --cert-key893 is given and the key file requires a passphrase.894 If not provided, you’ll be prompted interactively.895 """896)897 898#######################################################################899# Troubleshooting900#######################################################################901 902troubleshooting = options.add_group('Troubleshooting')903troubleshooting.add_argument(904 '--ignore-stdin',905 '-I',906 action='store_true',907 default=False,908 short_help='Do not attempt to read stdin'909)910troubleshooting.add_argument(911 '--help',912 action='help',913 default=Qualifiers.SUPPRESS,914 short_help='Show this help message and exit.',915)916troubleshooting.add_argument(917 '--manual',918 action='manual',919 default=Qualifiers.SUPPRESS,920 short_help='Show the full manual.',921)922troubleshooting.add_argument(923 '--version',924 action='version',925 version=__version__,926 short_help='Show version and exit.',927)928troubleshooting.add_argument(929 '--traceback',930 action='store_true',931 default=False,932 short_help='Prints the exception traceback should one occur.',933)934troubleshooting.add_argument(935 '--default-scheme',936 default='http',937 short_help='The default scheme to use if not specified in the URL.'938)939troubleshooting.add_argument(940 '--debug',941 action='store_true',942 default=False,943 short_help='Print useful diagnostic information for bug reports.',944 help="""945 Prints the exception traceback should one occur, as well as other946 information useful for debugging HTTPie itself and for reporting bugs.947 948 """,949)950 951#######################################################################952# Finalization953#######################################################################954 955options.finalize()956parser = to_argparse(options)957 