wizlib 3.1.1__tar.gz → 3.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wizlib
3
- Version: 3.1.1
3
+ Version: 3.1.3
4
4
  Summary: Framework for flexible and powerful command-line applications
5
5
  License: MIT
6
6
  Author: Steampunk Wizard
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "wizlib"
3
- version = "3.1.1"
3
+ version = "3.1.3"
4
4
  description = "Framework for flexible and powerful command-line applications"
5
5
  authors = ["Steampunk Wizard <wizlib@steampunkwizard.ca>"]
6
6
  license = "MIT"
@@ -70,15 +70,18 @@ class WizApp:
70
70
  """Set up the parser for the app class"""
71
71
  cls.parser = WizParser(prog=cls.name)
72
72
  subparsers = cls.parser.add_subparsers(dest='command')
73
+ cls.dparser = WizParser(prog=f"{cls.name} {cls.base.default}")
73
74
  for command in cls.base.family_members('name'):
74
75
  key = command.get_member_attr('key')
75
76
  aliases = [key] if key else []
76
77
  subparser = subparsers.add_parser(command.name, aliases=aliases)
77
78
  if command.name == cls.base.default:
78
- cls.dparser = subparser
79
+ command.add_args(cls.dparser)
79
80
  command.add_args(subparser)
80
81
  for handler in cls.handlers:
81
82
  handler.add_args(cls.parser)
83
+ # Throws ArgumentError if the default command includes an optional
84
+ # argument that overlaps with one of the handlers
82
85
  handler.add_args(cls.dparser)
83
86
 
84
87
  def __init__(self, **vals):
@@ -110,3 +113,8 @@ class WizApp:
110
113
  print()
111
114
  if command.status:
112
115
  print(command.status, file=sys.stderr)
116
+
117
+ def parse_run(self, *args):
118
+ """For testing, parse just the command part and tun"""
119
+ ns = self.parser.parse_args(args)
120
+ self.run(**vars(ns))
@@ -5,4 +5,5 @@ class SuperWrapper:
5
5
  def wrapper(self, *args, **kwargs):
6
6
  parent_method = getattr(parent_class, method.__name__)
7
7
  return parent_method(self, method, *args, **kwargs)
8
+ wrapper.__name__ = method.__name__
8
9
  return wrapper
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes