Commit fe7f351d authored by jpic ∞'s avatar jpic ∞ 💾
Browse files

Add default option value support

parent 08bc843e
......@@ -14,12 +14,13 @@ def command(**config):
class Option:
def __init__(self, name, help=None, color=None, alias=None,
immediate=False, default=None): = name = help or 'Undocumented option'
self.color = color or ''
self.alias = alias
self.immediate = immediate
self.default = default
def option(name, **cfg):
......@@ -41,6 +41,10 @@ class Parser:
for arg in self.argv:
for name, option in self.command.options.items():
if name not in self.options:
self.options[name] = option.default
def get_option(self, name):
name = name.lstrip('-')
for option in self.command.options.values():
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment