equal
deleted
inserted
replaced
2012 |
2012 |
2013 def command(table): |
2013 def command(table): |
2014 '''returns a function object bound to table which can be used as |
2014 '''returns a function object bound to table which can be used as |
2015 a decorator for populating table as a command table''' |
2015 a decorator for populating table as a command table''' |
2016 |
2016 |
2017 def cmd(name, options, synopsis=None): |
2017 def cmd(name, options=(), synopsis=None): |
2018 def decorator(func): |
2018 def decorator(func): |
2019 if synopsis: |
2019 if synopsis: |
2020 table[name] = func, options[:], synopsis |
2020 table[name] = func, list(options), synopsis |
2021 else: |
2021 else: |
2022 table[name] = func, options[:] |
2022 table[name] = func, list(options) |
2023 return func |
2023 return func |
2024 return decorator |
2024 return decorator |
2025 |
2025 |
2026 return cmd |
2026 return cmd |