Allow to customize color for CLI prompts

This commit is contained in:
Alexandre Aubin 2019-09-27 17:40:44 +02:00
parent 27afb4dc04
commit 808f6203fd

View file

@ -307,7 +307,7 @@ class MoulinetteSignals(object):
return authenticator return authenticator
return self._authenticate(authenticator, help) return self._authenticate(authenticator, help)
def prompt(self, message, is_password=False, confirm=False): def prompt(self, message, is_password=False, confirm=False, color='blue'):
"""Prompt for a value """Prompt for a value
Prompt the interface for a parameter value which is a password Prompt the interface for a parameter value which is a password
@ -320,12 +320,13 @@ class MoulinetteSignals(object):
- message -- The message to display - message -- The message to display
- is_password -- True if the parameter is a password - is_password -- True if the parameter is a password
- confirm -- True if the value must be confirmed - confirm -- True if the value must be confirmed
- color -- Color to use for the prompt ...
Returns: Returns:
The collected value The collected value
""" """
return self._prompt(message, is_password, confirm) return self._prompt(message, is_password, confirm, color=color)
def display(self, message, style='info'): def display(self, message, style='info'):
"""Display a message """Display a message