aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjake <jake@jakes-mail.top>2022-01-19 19:53:29 -0500
committerjake <jake@jakes-mail.top>2022-01-19 19:53:29 -0500
commit5f750167f4d6b89ffd1c534dde00b08d7ed4482d (patch)
tree1e5e4511e1d48e364dee3b4a366001247fb176ea
parent02d4f062542e7632ba116ffeed8536e90892a619 (diff)
toggle() now toggles without calling external function
-rwxr-xr-xgmi.pl13
1 files 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 {