summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-10-21 16:18:20 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-10-21 16:18:20 +0000
commit01508b09ee68c55499c1b1a5ea658bb03204b96c (patch)
tree2c7bb480fad36a9cf020a42dcdeedf83552927ea
parent4d4f0f02bdb78f485e0735e591b98204e6fe8d11 (diff)
downloadurpmi-01508b09ee68c55499c1b1a5ea658bb03204b96c.tar
urpmi-01508b09ee68c55499c1b1a5ea658bb03204b96c.tar.gz
urpmi-01508b09ee68c55499c1b1a5ea658bb03204b96c.tar.bz2
urpmi-01508b09ee68c55499c1b1a5ea658bb03204b96c.tar.xz
urpmi-01508b09ee68c55499c1b1a5ea658bb03204b96c.zip
create urpm::msg::ask_yes_or_no() to remove duplication
-rw-r--r--urpm/msg.pm5
-rwxr-xr-xurpmi6
2 files changed, 8 insertions, 3 deletions
diff --git a/urpm/msg.pm b/urpm/msg.pm
index c61a9187..f9cd07e1 100644
--- a/urpm/msg.pm
+++ b/urpm/msg.pm
@@ -102,6 +102,11 @@ sub bug_log {
}
}
+sub ask_yes_or_no {
+ my ($msg) = @_;
+ message_input_($msg . N(" (y/N) "), boolean => 1) =~ /[$yesexpr]/;
+}
+
#- deprecated, use message_input_() instead
sub message_input { &_message_input }
diff --git a/urpmi b/urpmi
index 45203cbc..1688e4e5 100755
--- a/urpmi
+++ b/urpmi
@@ -538,7 +538,7 @@ have to be removed for others to be upgraded:\n%s\n", $list);
print "$msg\n";
} else {
my $yesexpr = N("Yy");
- $force || message_input_($msg . N(" (y/N) "), boolean => 1) =~ /[$yesexpr]/ or exit 0;
+ $force || urpm::msg::ask_yes_or_no($msg) or exit 0;
}
}
@@ -633,13 +633,13 @@ my $exit_code = urpm::main_loop::run($urpm, $state,
0;
} else {
my $yesexpr = N("Yy");
- $force || message_input_("$msg$msg2" . N(" (y/N) "), boolean => 1) =~ /[$yesexpr]/;
+ $force || urpm::msg::ask_yes_or_no("$msg$msg2");
}
},
ask_yes_or_no => sub {
my ($_title, $msg) = @_; # graphical title
my $yesexpr = N("Yy");
- $force || message_input_($msg . N(" (y/N) "), boolean => 1) =~ /[$yesexpr]/;
+ $force || urpm::msg::ask_yes_or_no($msg);
},
need_restart => sub {
my ($need_restart_formatted) = @_;