summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
11cd059)
Using Getopt::Long takes ~the same time as running the rest of the script,
about 250ms on a rpi1, so runtime can be halved if there's no options.
-use Getopt::Long '2.33', qw( :config gnu_getopt );
+if (@ARGV) {
+require Getopt::Long;
+Getopt::Long->import('2.33', qw( :config gnu_getopt ));
GetOptions(\%opt,
'ascii|a!',
'color|c!',
GetOptions(\%opt,
'ascii|a!',
'color|c!',
);
},
) or exit 64; # EX_USAGE
);
},
) or exit 64; # EX_USAGE
$opt{width} ||= $ENV{COLUMNS} || qx(tput cols) || 80 unless $opt{spark};
$opt{color} //= -t *STDOUT; # enable on tty
$opt{width} ||= $ENV{COLUMNS} || qx(tput cols) || 80 unless $opt{spark};
$opt{color} //= -t *STDOUT; # enable on tty