From 7c13fd24dc96ef7c6e39c867ba601a1d9b1cb3cf Mon Sep 17 00:00:00 2001 From: Landry Breuil Date: Sat, 5 Jun 2010 07:35:22 +0000 Subject: Move ask_list() method to $state object like it's done for confirm(), so that it can be overriden. Change callers accordingly. ok espie@ --- usr.sbin/pkg_add/OpenBSD/AddDelete.pm | 12 ++++++++++-- usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm index ecf151b91be..284a5824a4f 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddDelete.pm,v 1.21 2010/06/04 13:19:39 espie Exp $ +# $OpenBSD: AddDelete.pm,v 1.22 2010/06/05 07:35:21 landry Exp $ # # Copyright (c) 2007-2010 Marc Espie # @@ -272,7 +272,7 @@ sub choose_location $h{''} = undef; $state->progress->clear; - my $result = OpenBSD::Interactive::ask_list("Ambiguous: choose package for $name", 1, sort keys %h); + my $result = $state->ask_list("Ambiguous: choose package for $name", 1, sort keys %h); return $h{$result}; } else { $state->errsay("Ambiguous: $name could be ", join(' ', keys %h)); @@ -289,6 +289,14 @@ sub confirm return OpenBSD::Interactive::confirm($prompt, $default); } +sub ask_list +{ + my ($state, $prompt, $interactive, @values) = @_; + + require OpenBSD::Interactive; + return OpenBSD::Interactive::ask_list($prompt, $interactive, @values); +} + sub status { my $self = shift; diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 29c1ea51faa..80c793f16cd 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Dependencies.pm,v 1.127 2010/06/04 13:19:39 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.128 2010/06/05 07:35:21 landry Exp $ # # Copyright (c) 2005-2010 Marc Espie # @@ -421,7 +421,7 @@ sub find_dep_in_repositories # put default first if available @pkgs = ((grep {$_ eq $dep->{def}} @pkgs), (sort (grep {$_ ne $dep->{def}} @pkgs))); - my $good = OpenBSD::Interactive::ask_list( + my $good = $state->ask_list( 'Ambiguous: choose dependency for '.$self->{set}->print.': ', $state->{interactive}, @pkgs); return $c{$good}; -- cgit v1.2.3