@@ -192,15 +192,16 @@ def cmd_wrapper(cmd2_instance, statement: Union[Statement, str]):
192192
193193
194194def with_argparser_and_unknown_args (argparser : argparse .ArgumentParser , * ,
195- ns_provider : Optional [Callable [[ None ] , argparse .Namespace ]] = None ,
195+ ns_provider : Optional [Callable [... , argparse .Namespace ]] = None ,
196196 preserve_quotes : bool = False ) -> \
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 ns_provider: an optional function that provides the Namespace for parse_known_args().
203- this is useful if the Namespace needs to be prepopulated based on instance data.
202+ :param ns_provider: An optional function that accepts a cmd2.Cmd object as an argument and returns an
203+ argparse.Namespace. This is useful if the Namespace needs to be prepopulated with
204+ state data that affects parsing.
204205 :param preserve_quotes: if True, then arguments passed to argparse maintain their quotes
205206 :return: function that gets passed argparse-parsed args in a Namespace and a list of unknown argument strings
206207 A member called __statement__ is added to the Namespace to provide command functions access to the
@@ -251,14 +252,15 @@ def cmd_wrapper(cmd2_instance, statement: Union[Statement, str]):
251252
252253
253254def with_argparser (argparser : argparse .ArgumentParser , * ,
254- ns_provider : Optional [Callable [[ None ] , argparse .Namespace ]] = None ,
255+ ns_provider : Optional [Callable [... , argparse .Namespace ]] = None ,
255256 preserve_quotes : bool = False ) -> 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
260- :param ns_provider: an optional function that provides the Namespace for parse_args().
261- this is useful if the Namespace needs to be prepopulated based on instance data.
261+ :param ns_provider: An optional function that accepts a cmd2.Cmd object as an argument and returns an
262+ argparse.Namespace. This is useful if the Namespace needs to be prepopulated with
263+ state data that affects parsing.
262264 :param preserve_quotes: if True, then arguments passed to argparse maintain their quotes
263265 :return: function that gets passed the argparse-parsed args in a Namespace
264266 A member called __statement__ is added to the Namespace to provide command functions access to the
0 commit comments