Skip to content

Commit fff34d2

Browse files
committed
Changed order of function arguments
1 parent 366c309 commit fff34d2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cmd2/cmd2.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,16 @@ def cmd_wrapper(cmd2_instance, statement: Union[Statement, str]):
192192

193193

194194
def with_argparser_and_unknown_args(argparser: argparse.ArgumentParser,
195-
ns_provider: Optional[Callable[[None], argparse.Namespace]] = None,
196-
preserve_quotes: bool = False) -> \
195+
preserve_quotes: bool = False,
196+
ns_provider: Optional[Callable[[None], argparse.Namespace]] = None,) -> \
197197
Callable[[argparse.Namespace, List], Optional[bool]]:
198198
"""A decorator to alter a cmd2 method to populate its ``args`` argument by parsing arguments with the given
199199
instance of argparse.ArgumentParser, but also returning unknown args as a list.
200200
201201
:param argparser: unique instance of ArgumentParser
202+
:param preserve_quotes: if True, then arguments passed to argparse maintain their quotes
202203
:param ns_provider: an optional function that provides the Namespace for parse_known_args().
203204
this is useful if the Namespace needs to be prepopulated based on instance data.
204-
:param preserve_quotes: if True, then arguments passed to argparse maintain their quotes
205205
:return: function that gets passed argparse-parsed args in a Namespace and a list of unknown argument strings
206206
A member called __statement__ is added to the Namespace to provide command functions access to the
207207
Statement object. This can be useful if the command function needs to know the command line.
@@ -251,15 +251,16 @@ def cmd_wrapper(cmd2_instance, statement: Union[Statement, str]):
251251

252252

253253
def with_argparser(argparser: argparse.ArgumentParser,
254-
ns_provider: Optional[Callable[[None], argparse.Namespace]] = None,
255-
preserve_quotes: bool = False) -> Callable[[argparse.Namespace], Optional[bool]]:
254+
preserve_quotes: bool = False,
255+
ns_provider: Optional[Callable[[None], argparse.Namespace]] = None) -> \
256+
Callable[[argparse.Namespace], Optional[bool]]:
256257
"""A decorator to alter a cmd2 method to populate its ``args`` argument by parsing arguments
257258
with the given instance of argparse.ArgumentParser.
258259
259260
:param argparser: unique instance of ArgumentParser
261+
:param preserve_quotes: if True, then arguments passed to argparse maintain their quotes
260262
:param ns_provider: an optional function that provides the Namespace for parse_args().
261263
this is useful if the Namespace needs to be prepopulated based on instance data.
262-
:param preserve_quotes: if True, then arguments passed to argparse maintain their quotes
263264
:return: function that gets passed the argparse-parsed args in a Namespace
264265
A member called __statement__ is added to the Namespace to provide command functions access to the
265266
Statement object. This can be useful if the command function needs to know the command line.

0 commit comments

Comments
 (0)