From 5f750167f4d6b89ffd1c534dde00b08d7ed4482d Mon Sep 17 00:00:00 2001 From: jake Date: Wed, 19 Jan 2022 19:53:29 -0500 Subject: toggle() now toggles without calling external function --- gmi.pl | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/gmi.pl b/gmi.pl index 5be6e00..03563dd 100755 --- a/gmi.pl +++ b/gmi.pl @@ -10,7 +10,7 @@ use bytes; use feature qw(refaliasing); no warnings qw(experimental::refaliasing); -our $VERSION = 'v0.0.21'; +our $VERSION = 'v0.0.22'; # TODO: # back() only works once; should fix this @@ -82,7 +82,7 @@ my %commands = ( 'display' => [sub { display() }, 'Display the current page.' ], 'd' => [sub { display() }, 'Alias of `display\'.' ], - 'usepager' => [sub { toggle('pager') }, 'This toggles pager use. 1 = use pager, 0 = stdout.' ], + 'usepager' => [sub { toggle($use_pager) }, 'This toggles pager use. 1 = use pager, 0 = stdout.' ], 'textwrap' => [sub { textwrap($_[0]) }, 'Set textwrap length.\nGiving \'auto\' will ' . "automatically determine the appropriate length. (Currently $wrapper->{columns})"], 'pager' => [sub { pager($_[0]) }, "Set which pager to use. (currently $ENV{pager})"], @@ -498,14 +498,6 @@ sub display { } sub toggle { - my ($t) = @_; - if ($t eq 'pager') { - set_toggle($use_pager); - print "$use_pager\n"; - } -} - -sub set_toggle { # refaliasing \my $t = \$_[0]; if ($t == 1) { @@ -514,6 +506,7 @@ sub set_toggle { else { $t = 1; } + print "$t\n"; } sub textwrap { -- cgit v1.2.3