From 594a1a3c32b7d5bc3ccae6de8a07319d01519f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Mon, 2 Jun 2014 21:03:08 +0200 Subject: [PATCH] [enh] Better confirmation prompting --- locales/en.json | 2 +- locales/fr.json | 2 +- moulinette/interfaces/cli.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/locales/en.json b/locales/en.json index bf8c2f3f..6d0755ec 100644 --- a/locales/en.json +++ b/locales/en.json @@ -17,7 +17,7 @@ "argument_required" : "Argument {:s} is required", "password" : "Password", "invalid_password" : "Invalid password", - "confirm" : "Confirm", + "confirm" : "Confirm {:s}", "values_mismatch" : "Values don't match", "authentication_required_long" : "Authentication is required to perform this action", "authentication_required" : "Authentication required", diff --git a/locales/fr.json b/locales/fr.json index af926113..232ec6e7 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -17,7 +17,7 @@ "argument_required" : "L'argument {:s} est requis", "password" : "Mot de passe", "invalid_password" : "Mot de passe incorrect", - "confirm" : "Confirmez", + "confirm" : "Confirmez le {:s}", "values_mismatch" : "Les valeurs ne correspondent pas", "authentication_required_long" : "L'authentification est requise pour exécuter cette action", "authentication_required" : "Authentification requise", diff --git a/moulinette/interfaces/cli.py b/moulinette/interfaces/cli.py index b4ebb265..2565d57e 100644 --- a/moulinette/interfaces/cli.py +++ b/moulinette/interfaces/cli.py @@ -239,7 +239,8 @@ class Interface(BaseInterface): value = prompt(message) if confirm: - if prompt('%s %s' % (m18n.g('confirm'), message)) != value: + m = message[0].lower() + message[1:] + if prompt(m18n.g('confirm', m)) != value: raise MoulinetteError(errno.EINVAL, m18n.g('values_mismatch')) return value