1
0
mirror of https://github.com/httpie/cli.git synced 2024-11-24 08:22:22 +02:00

Short option for --headers is now -h.

-t has been removed, for usage use --help
This commit is contained in:
Jakub Roztocil 2012-07-24 17:17:26 +02:00
parent 7af08b6faa
commit 76ebe7c6db
3 changed files with 17 additions and 8 deletions

View File

@ -189,10 +189,10 @@ respectivelly::
Flags
^^^^^
Most of the flags mirror the arguments understood by ``requests.request``.
See ``http -h`` for more details::
See ``http --help`` for more details::
$ http --help
usage: http [-h] [--version] [--json | --form] [--traceback]
# http --help
usage: http [--help] [--version] [--json | --form] [--traceback]
[--pretty | --ugly]
[--print OUTPUT_OPTIONS | --verbose | --headers | --body]
[--style STYLE] [--check-status] [--auth AUTH]
@ -214,13 +214,13 @@ See ``http -h`` for more details::
separator used. It can be an HTTP header
(header:value), a data field to be used in the request
body (field_name=value), a raw JSON data field
(field_name:=value), a query parameter (name=value),
(field_name:=value), a query parameter (name==value),
or a file field (field_name@/path/to/file). You can
use a backslash to escape a colliding separator in the
field name.
optional arguments:
-h, --help show this help message and exit
--help show this help message and exit
--version show program's version number and exit
--json, -j (default) Data items from the command line are
serialized as a JSON object. The Content-Type and
@ -248,7 +248,7 @@ See ``http -h`` for more details::
body is printed by default.
--verbose, -v Print the whole request as well as the response.
Shortcut for --print=HBhb.
--headers, -t Print only the response headers. Shortcut for
--headers, -h Print only the response headers. Shortcut for
--print=h.
--body, -b Print only the response body. Shortcut for --print=b.
--style STYLE, -s STYLE
@ -288,7 +288,6 @@ See ``http -h`` for more details::
socket.setdefaulttimeout() as fallback).
Contribute
-----------
@ -328,6 +327,8 @@ Changelog
---------
* `0.2.6dev <https://github.com/jkbr/httpie/compare/0.2.5...master>`_
* Short option for ``--headers`` is now ``-h`` (``-t`` has been removed,
for usage use ``--help``).
* Form data and URL params can now have mutiple fields with the same name
(e.g.,``http -f url a=1 a=2``).
* Added ``--check-status`` to exit with an error for HTTP 3xx, 4xx and

View File

@ -98,7 +98,7 @@ output_options.add_argument(
'''.format(''.join(cliparse.OUTPUT_OPTIONS)))
)
output_options.add_argument(
'--headers', '-t', dest='output_options',
'--headers', '-h', dest='output_options',
action='store_const', const=cliparse.OUT_RESP_HEAD,
help=_('''
Print only the response headers.

View File

@ -51,6 +51,14 @@ DEFAULT_UA = 'HTTPie/%s' % __version__
class Parser(argparse.ArgumentParser):
def __init__(self, *args, **kwargs):
kwargs['add_help'] = False
super(Parser, self).__init__(*args, **kwargs)
# Help only as --help (-h is used for --headers).
self.add_argument('--help',
action='help', default=argparse.SUPPRESS,
help=argparse._('show this help message and exit'))
def parse_args(self, env, args=None, namespace=None):
args = super(Parser, self).parse_args(args, namespace)