[enh] List available domains when installing an app by CLI.

This commit is contained in:
likeitneverwentaway 2016-12-12 09:03:50 +01:00 committed by Moul
parent 656bb809d1
commit 64af6a1dbf
2 changed files with 9 additions and 1 deletions

View file

@ -84,6 +84,7 @@
"domain_zone_exists": "DNS zone file already exists",
"domain_zone_not_found": "DNS zone file not found for domain {:s}",
"done": "Done",
"domains_available": "Available domains:",
"downloading": "Downloading...",
"dyndns_cron_installed": "The DynDNS cron job has been installed",
"dyndns_cron_remove_failed": "Unable to remove the DynDNS cron job",

View file

@ -1497,7 +1497,7 @@ def _parse_args_from_manifest(manifest, action, args={}, auth=None):
args -- A dictionnary of arguments to parse
"""
from yunohost.domain import domain_list
from yunohost.domain import domain_list, _get_maindomain
from yunohost.user import user_info
args_dict = OrderedDict()
@ -1537,6 +1537,13 @@ def _parse_args_from_manifest(manifest, action, args={}, auth=None):
# Check for a password argument
is_password = True if arg_type == 'password' else False
if arg_type == 'domain':
arg_default = _get_maindomain()
ask_string += ' (default: {0})'.format(arg_default)
msignals.display(m18n.n('domains_available'))
for domain in domain_list(auth)['domains']:
msignals.display("- {}".format(domain))
try:
input_string = msignals.prompt(ask_string, is_password)
except NotImplementedError: