summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-12-17 11:11:52 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-12-17 11:11:52 +0000
commit056cefac912a16640dcbb8f2c1dbd8f97ca3603f (patch)
treebd0bc66478b7f63cc071bb49b89e62c9c3c1d8bf
parent1c03ee6c6dcfd52bc84bb4cc3a7b0ed1a9276ed2 (diff)
move the ntogo actual code in the progressmeter, so that -x shuts it off.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/AddDelete.pm13
-rw-r--r--usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm13
2 files changed, 19 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
index b27ffb8f521..573c0569f5a 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.6 2009/12/14 09:35:56 espie Exp $
+# $OpenBSD: AddDelete.pm,v 1.7 2009/12/17 11:11:51 espie Exp $
#
# Copyright (c) 2007-2009 Marc Espie <espie@openbsd.org>
#
@@ -222,11 +222,7 @@ sub ntogo
{
my $self = shift;
- if (defined $self->{todo} && $self->{todo} > 0) {
- return " ($self->{todo} to go)";
- } else {
- return "";
- }
+ return $self->progress->ntogo($self->{todo});
}
sub vstat
@@ -368,6 +364,11 @@ sub print
print @_;
}
+sub ntogo
+{
+ return "";
+}
+
sub errprint
{
shift;
diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm
index c20670e7b46..be7f8d7cc65 100644
--- a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm
+++ b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: ProgressMeter.pm,v 1.24 2009/12/14 09:35:56 espie Exp $
+# $OpenBSD: ProgressMeter.pm,v 1.25 2009/12/17 11:11:51 espie Exp $
#
# Copyright (c) 2004-2007 Marc Espie <espie@openbsd.org>
#
@@ -159,4 +159,15 @@ sub next
print "$header: ok$todo\n";
}
+sub ntogo
+{
+ my ($self, $todo) = @_;
+
+ if (defined $todo && $todo > 0) {
+ return " ($todo to go)";
+ } else {
+ return "";
+ }
+}
+
1;