diff options
author | kotfu <kotfu@kotfu.net> | 2018-01-14 22:27:52 -0700 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2018-01-14 22:27:52 -0700 |
commit | eb12773ab8cba72bfa593f53533423e25d823765 (patch) | |
tree | d02afbd54a3443ac96ca94370207b7b1cf37f3b4 /cmd2.py | |
parent | 6454f4e3ba61bdac9cdd09528d58261ecb235b5e (diff) | |
parent | 07e37b2d081161af32feb64890b1fd4236bf5f13 (diff) | |
download | cmd2-git-eb12773ab8cba72bfa593f53533423e25d823765.tar.gz |
Merge branch 'arglist' of github.com:python-cmd2/cmd2 into arglist
Diffstat (limited to 'cmd2.py')
-rwxr-xr-x | cmd2.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -258,6 +258,7 @@ def parse_quoted_string(cmdline): lexed_arglist = temp_arglist return lexed_arglist + def with_argument_parser(argparser): """A decorator to alter a cmd2 method to populate its ``opts`` argument by parsing arguments with the given instance of @@ -293,6 +294,8 @@ def with_argument_list(func): def cmd_wrapper(self, cmdline): lexed_arglist = parse_quoted_string(cmdline) func(self, lexed_arglist) + + cmd_wrapper.__doc__ = func.__doc__ return cmd_wrapper @@ -1665,10 +1668,11 @@ a..b, a:b, a:, ..b by indices (inclusive) arg is string containing string arg is /regex/ matching regular expression regex""" argparser.add_argument('arg', nargs='*', help=_history_arg_help) + @with_argument_parser(argparser) def do_history(self, arglist, args): # If an argument was supplied, then retrieve partial contents of the history - if arglist: + if args.arg: # If a character indicating a slice is present, retrieve a slice of the history arg = args.arg[0] if '..' in arg or ':' in arg: |