mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
cli questions: Restore displaying available choices, though limit to the first 20 available options
This commit is contained in:
parent
2d158b5a6d
commit
d1c371ec38
2 changed files with 17 additions and 1 deletions
|
@ -541,6 +541,7 @@
|
||||||
"migrations_to_be_ran_manually": "Migration {id} has to be run manually. Please go to Tools → Migrations on the webadmin page, or run `yunohost tools migrations run`.",
|
"migrations_to_be_ran_manually": "Migration {id} has to be run manually. Please go to Tools → Migrations on the webadmin page, or run `yunohost tools migrations run`.",
|
||||||
"not_enough_disk_space": "Not enough free space on '{path}'",
|
"not_enough_disk_space": "Not enough free space on '{path}'",
|
||||||
"operation_interrupted": "The operation was manually interrupted?",
|
"operation_interrupted": "The operation was manually interrupted?",
|
||||||
|
"other_available_options": "... and {n} other available options not shown",
|
||||||
"packages_upgrade_failed": "Could not upgrade all the packages",
|
"packages_upgrade_failed": "Could not upgrade all the packages",
|
||||||
"password_listed": "This password is among the most used passwords in the world. Please choose something more unique.",
|
"password_listed": "This password is among the most used passwords in the world. Please choose something more unique.",
|
||||||
"password_too_simple_1": "The password needs to be at least 8 characters long",
|
"password_too_simple_1": "The password needs to be at least 8 characters long",
|
||||||
|
|
|
@ -566,7 +566,22 @@ class Question(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
def _format_text_for_user_input_in_cli(self):
|
def _format_text_for_user_input_in_cli(self):
|
||||||
return _value_for_locale(self.ask)
|
|
||||||
|
text_for_user_input_in_cli = _value_for_locale(self.ask)
|
||||||
|
|
||||||
|
if self.choices:
|
||||||
|
|
||||||
|
# Prevent displaying a shitload of choices
|
||||||
|
# (e.g. 100+ available users when choosing an app admin...)
|
||||||
|
choices_to_display = self.choices[:20]
|
||||||
|
remaining_choices = len(self.choices[20:])
|
||||||
|
|
||||||
|
if remaining_choices > 0:
|
||||||
|
choices_to_display += [m18n.n("other_available_options", n=remaining_choices)]
|
||||||
|
|
||||||
|
text_for_user_input_in_cli += " [{0}]".format(" | ".join(choices_to_display))
|
||||||
|
|
||||||
|
return text_for_user_input_in_cli
|
||||||
|
|
||||||
def _post_parse_value(self):
|
def _post_parse_value(self):
|
||||||
if not self.redact:
|
if not self.redact:
|
||||||
|
|
Loading…
Add table
Reference in a new issue