mercurial/cmdutil.py
changeset 18235 9807e7d596c3
parent 18206 2c1276825e93
child 18243 b3b1b8e127e5
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