comparison mercurial/cmdutil.py @ 18235:9807e7d596c3

cmdutil: make options argument optional There is not reason to force passing of an empty options list.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Fri, 04 Jan 2013 13:48:07 +0100
parents 2c1276825e93
children b3b1b8e127e5
comparison
equal deleted inserted replaced
18234:a55b06885cda 18235:9807e7d596c3
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