mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Rely on format string method for ask_string encoding in hook
This commit is contained in:
parent
cfb952f108
commit
a0da8060f6
1 changed files with 3 additions and 5 deletions
8
hook.py
8
hook.py
|
@ -129,7 +129,7 @@ def hook_exec(file, args=None):
|
||||||
args -- Arguments to pass to the script
|
args -- Arguments to pass to the script
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from yunohost.app import _value_for_locale, _encode_string
|
from yunohost.app import _value_for_locale
|
||||||
|
|
||||||
if isinstance(args, list):
|
if isinstance(args, list):
|
||||||
arg_list = args
|
arg_list = args
|
||||||
|
@ -152,11 +152,9 @@ def hook_exec(file, args=None):
|
||||||
|
|
||||||
# Append extra strings
|
# Append extra strings
|
||||||
if 'choices' in arg:
|
if 'choices' in arg:
|
||||||
ask_string += ' ({:s})'.format(
|
ask_string += ' ({:s})'.format('|'.join(arg['choices']))
|
||||||
_encode_string('|'.join(arg['choices'])))
|
|
||||||
if 'default' in arg:
|
if 'default' in arg:
|
||||||
ask_string += ' (default: {:s})'.format(
|
ask_string += ' (default: {:s})'.format(arg['default'])
|
||||||
_encode_string(arg['default']))
|
|
||||||
|
|
||||||
input_string = msignals.prompt(ask_string)
|
input_string = msignals.prompt(ask_string)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue