about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-06-14 21:52:12 +0530
committerAndinus <andinus@nand.sh>2020-06-14 21:52:12 +0530
commit2d289f14eddb5f4fd1eddd88ed84487aef7c97e1 (patch)
tree06a7f245e79eba44c41aea569698dfdd86b4b841
parentd19834d8829b50b688b16c1f7f5e979f36d6f569 (diff)
downloadara-2d289f14eddb5f4fd1eddd88ed84487aef7c97e1.tar.gz
Add option to remove number formatting with words
-rwxr-xr-xara.pl12
1 files changed, 7 insertions, 5 deletions
diff --git a/ara.pl b/ara.pl
index f73d481..f232d32 100755
--- a/ara.pl
+++ b/ara.pl
@@ -29,7 +29,7 @@ foreach my $path (@INC) {
 }
 
 my ( $use_local_file, $get_latest, $state_notes, $rows_to_print, $no_delta,
-     $no_total, @to_hide, %hide, @to_show, %show );
+     $no_total, @to_hide, %hide, @to_show, %show, $no_words );
 
 GetOptions(
     "local" => \$use_local_file,
@@ -38,6 +38,7 @@ GetOptions(
     "rows=i" => \$rows_to_print,
     "nodelta" => \$no_delta,
     "nototal" => \$no_total,
+    "nowords" => \$no_words,
     "hide=s{1,}" => \@to_hide, # Getopt::Long docs say that this is an
                                # experimental feature with a warning.
     "show=s{1,}" => \@to_show,
@@ -84,6 +85,7 @@ sub HelpMessage {
     --rows=i  Number of rows to print (i is Integer)
     --nodelta Don't print changes in values
     --nototal Don't print 'Total' row
+    --nowords Don't format numbers with words
     --hide    Hide states, columns from table (space seperated)
     --show    Show only these states (space seperated)";
     print LOCALCOLOR CYAN "
@@ -198,10 +200,10 @@ if ( $state_notes ) {
         ->plus_minutes(30); # Current time in 'Asia/Kolkata' TimeZone.
 }
 
-my $fmt = Number::Format::SouthAsian->new(
-    words => 1,
-    decimals => 2
-);
+my %format_with_words;
+%format_with_words = ( words => 1, decimals => 2 )
+    unless $no_words;
+my $fmt = Number::Format::SouthAsian->new( %format_with_words );
 
 my $rows_printed = 0;
 foreach my $i ( 0 ... scalar @$statewise - 1 ) {