|
27 | 27 |
|
28 | 28 | try:
|
29 | 29 | import argcomplete
|
30 |
| - ARGCOMLETE_IMPORTED = True |
| 30 | + ARGCOMPLETE_IMPORTED = True |
31 | 31 | except ImportError:
|
32 |
| - ARGCOMLETE_IMPORTED = False |
| 32 | + ARGCOMPLETE_IMPORTED = False |
33 | 33 |
|
34 | 34 |
|
35 | 35 | class Manager(object):
|
@@ -167,7 +167,7 @@ def _create_command(item):
|
167 | 167 |
|
168 | 168 | ## enable autocomplete only for parent parser when argcomplete is
|
169 | 169 | ## imported and it is NOT disabled in constructor
|
170 |
| - if parents is None and ARGCOMLETE_IMPORTED \ |
| 170 | + if parents is None and ARGCOMPLETE_IMPORTED \ |
171 | 171 | and not self.disable_argcomplete:
|
172 | 172 | argcomplete.autocomplete(parser, always_complete_options=True)
|
173 | 173 |
|
@@ -295,49 +295,6 @@ def _make_context(app):
|
295 | 295 |
|
296 | 296 | return func
|
297 | 297 |
|
298 |
| - def get_usage(self): |
299 |
| - |
300 |
| - """ |
301 |
| - Returns string consisting of all commands and their |
302 |
| - descriptions. |
303 |
| - """ |
304 |
| - pad = max(map(len, self._commands.iterkeys())) + 2 |
305 |
| - format = ' %%- %ds%%s' % pad |
306 |
| - |
307 |
| - rv = [] |
308 |
| - |
309 |
| - if self.usage: |
310 |
| - rv.append(self.usage) |
311 |
| - |
312 |
| - for name, command in sorted(self._commands.iteritems()): |
313 |
| - usage = name |
314 |
| - |
315 |
| - if isinstance(command, Manager): |
316 |
| - description = command.usage or '' |
317 |
| - else: |
318 |
| - description = command.description or '' |
319 |
| - |
320 |
| - usage = format % (name, description) |
321 |
| - rv.append(usage) |
322 |
| - |
323 |
| - return "\n".join(rv) |
324 |
| - |
325 |
| - def print_usage(self): |
326 |
| - |
327 |
| - """ |
328 |
| - Prints result of get_usage() |
329 |
| - """ |
330 |
| - |
331 |
| - print self.get_usage() |
332 |
| - |
333 |
| - def _handle(self, app, *args, **kwargs): |
334 |
| - """ |
335 |
| - Calling manager without command prints usage message. |
336 |
| - """ |
337 |
| - with app.test_request_context(): |
338 |
| - self.print_usage() |
339 |
| - return 1 |
340 |
| - |
341 | 298 | def handle(self, prog, args=None):
|
342 | 299 |
|
343 | 300 | app_parser = self.create_parser(prog)
|
|
0 commit comments