3030import codecs
3131import collections
3232import datetime
33+ import functools
3334import glob
3435import io
3536import optparse
@@ -271,6 +272,7 @@ def with_argument_list(func):
271272 method. Default passes a string of whatever the user typed.
272273 With this decorator, the decorated method will receive a list
273274 of arguments parsed from user input using shlex.split()."""
275+ @functools .wraps (func )
274276 def cmd_wrapper (self , cmdline ):
275277 lexed_arglist = parse_quoted_string (cmdline )
276278 func (self , lexed_arglist )
@@ -288,6 +290,7 @@ def with_argparser_and_unknown_args(argparser, subcommand_names=None):
288290 :return: function that gets passed parsed args and a list of unknown args
289291 """
290292 def arg_decorator (func ):
293+ @functools .wraps (func )
291294 def cmd_wrapper (instance , cmdline ):
292295 lexed_arglist = parse_quoted_string (cmdline )
293296 args , unknown = argparser .parse_known_args (lexed_arglist )
@@ -324,6 +327,7 @@ def with_argparser(argparser, subcommand_names=None):
324327 :return: function that gets passed parsed args
325328 """
326329 def arg_decorator (func ):
330+ @functools .wraps (func )
327331 def cmd_wrapper (instance , cmdline ):
328332 lexed_arglist = parse_quoted_string (cmdline )
329333 args = argparser .parse_args (lexed_arglist )
@@ -387,6 +391,7 @@ def option_setup(func):
387391 option_parser .set_usage ("%s %s" % (func .__name__ [3 :], arg_desc ))
388392 option_parser ._func = func
389393
394+ @functools .wraps (func )
390395 def new_func (instance , arg ):
391396 """For @options commands this replaces the actual do_* methods in the instance __dict__.
392397
0 commit comments