mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[enh] Add auto-completion support in the cli
This commit is contained in:
parent
2e83d9d1ff
commit
349c03321d
2 changed files with 7 additions and 1 deletions
3
debian/control
vendored
3
debian/control
vendored
|
@ -14,7 +14,8 @@ Depends: ${misc:Depends}, ${python:Depends},
|
|||
python-yaml,
|
||||
python-bottle (>= 0.12),
|
||||
python-gnupg,
|
||||
python-gevent-websocket
|
||||
python-gevent-websocket,
|
||||
python-argcomplete
|
||||
Replaces: yunohost-cli
|
||||
Breaks: yunohost-cli
|
||||
Description: prototype interfaces with ease in Python
|
||||
|
|
|
@ -7,6 +7,8 @@ import getpass
|
|||
import locale
|
||||
from argparse import SUPPRESS
|
||||
|
||||
import argcomplete
|
||||
|
||||
from moulinette.core import MoulinetteError
|
||||
from moulinette.interfaces import (
|
||||
BaseActionsMapParser, BaseInterface, ExtendedArgumentParser,
|
||||
|
@ -294,6 +296,9 @@ class Interface(BaseInterface):
|
|||
if output_as and output_as not in ['json', 'plain']:
|
||||
raise MoulinetteError(errno.EINVAL, m18n.g('invalid_usage'))
|
||||
|
||||
# auto-complete
|
||||
argcomplete.autocomplete(self.actionsmap.parser._parser)
|
||||
|
||||
try:
|
||||
ret = self.actionsmap.process(args, timeout=5)
|
||||
except KeyboardInterrupt, EOFError:
|
||||
|
|
Loading…
Add table
Reference in a new issue