[enh] Add auto-completion support in the cli

This commit is contained in:
Jérôme Lebleu 2015-11-13 13:04:27 +01:00
parent 2e83d9d1ff
commit 349c03321d
2 changed files with 7 additions and 1 deletions

3
debian/control vendored
View file

@ -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

View file

@ -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: