Show More
@@ -96,15 +96,14 b' class _funcregistrarbase(object):' | |||
|
96 | 96 | """ |
|
97 | 97 | pass |
|
98 | 98 | |
|
99 | def command(table): | |
|
100 | """Returns a function object to be used as a decorator for making commands. | |
|
99 | class command(_funcregistrarbase): | |
|
100 | """Decorator to register a command function to table | |
|
101 | 101 | |
|
102 |
This |
|
|
102 | This class receives a command table as its argument. The table should | |
|
103 | 103 | be a dict. |
|
104 | 104 | |
|
105 |
The |
|
|
106 |
t |
|
|
107 | a command. | |
|
105 | The created object can be used as a decorator for adding commands to | |
|
106 | that command table. This accepts multiple arguments to define a command. | |
|
108 | 107 | |
|
109 | 108 | The first argument is the command name. |
|
110 | 109 | |
@@ -126,20 +125,18 b' def command(table):' | |||
|
126 | 125 | repository locations. See ``findrepo()``. If a repository is found, it |
|
127 | 126 | will be used. |
|
128 | 127 | """ |
|
129 | def cmd(name, options=(), synopsis=None, norepo=False, optionalrepo=False, | |
|
130 | inferrepo=False): | |
|
131 | def decorator(func): | |
|
128 | ||
|
129 | def _doregister(self, func, name, options=(), synopsis=None, | |
|
130 | norepo=False, optionalrepo=False, inferrepo=False): | |
|
131 | if True: | |
|
132 | 132 | func.norepo = norepo |
|
133 | 133 | func.optionalrepo = optionalrepo |
|
134 | 134 | func.inferrepo = inferrepo |
|
135 | 135 | if synopsis: |
|
136 | table[name] = func, list(options), synopsis | |
|
136 | self._table[name] = func, list(options), synopsis | |
|
137 | 137 | else: |
|
138 | table[name] = func, list(options) | |
|
138 | self._table[name] = func, list(options) | |
|
139 | 139 | return func |
|
140 | return decorator | |
|
141 | ||
|
142 | return cmd | |
|
143 | 140 | |
|
144 | 141 | class revsetpredicate(_funcregistrarbase): |
|
145 | 142 | """Decorator to register revset predicate |
General Comments 0
You need to be logged in to leave comments.
Login now