Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change Command.create_parser() to take in args/kwargs to future proof…

… API and provide a better example for subclassing
  • Loading branch information...
commit c93456d64824a770dbd4c7c55b567d370656e74a 1 parent f26b0ca
@techniq techniq authored
Showing with 2 additions and 6 deletions.
  1. +0 −3  flask_script/__init__.py
  2. +2 −3 flask_script/commands.py
View
3  flask_script/__init__.py
@@ -158,9 +158,6 @@ def create_parser(self, prog, parents=None):
command_parser = command.create_parser(name, parents=[options_parser])
subparser = subparsers.add_parser(name, usage=description, help=description,
parents=[command_parser], add_help=False)
- # subparser.set_defaults(func_handle=command.handle)
- # if isinstance(command, Manager):
- # subparser.set_defaults(func_handle=self.foo)
## enable autocomplete only for parent parser when argcomplete is
View
5 flask_script/commands.py
@@ -112,10 +112,9 @@ def get_options(self):
"""
return self.option_list
- def create_parser(self, prog, parents=None):
+ def create_parser(self, *args, **kwargs):
- parser = argparse.ArgumentParser(prog=prog, parents=parents,
- description=self.description)
+ parser = argparse.ArgumentParser(*args, **kwargs)
for option in self.get_options():
if isinstance(option, Group):
Please sign in to comment.
Something went wrong with that request. Please try again.