about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-06-11 01:32:11 +0530
committerAndinus <andinus@nand.sh>2020-06-11 01:33:30 +0530
commit434a3999daf0cc604fae9c7203145785c2578ff3 (patch)
treed3aa09cd59ba6c79ebffdf8f4f415cb24c1f3299
parente876bc2fc08e44f3ea94f5a0954acefefda774b6 (diff)
downloadara-434a3999daf0cc604fae9c7203145785c2578ff3.tar.gz
Add "nodelta" flag
"nodelta" flag will not print any delta changes.
-rwxr-xr-xara.pl17
1 files changed, 10 insertions, 7 deletions
diff --git a/ara.pl b/ara.pl
index 64210e7..d55fdfc 100755
--- a/ara.pl
+++ b/ara.pl
@@ -17,23 +17,25 @@ foreach my $path (@INC) {
         or die "Unable to unveil: $!";
 }
 
-my ( $use_local_file, $get_latest, $state_notes, $rows_to_print );
+my ( $use_local_file, $get_latest, $state_notes, $rows_to_print, $no_delta );
 
 GetOptions(
     "local" => \$use_local_file,
     "latest" => \$get_latest,
     "notes" => \$state_notes,
     "rows=i" => \$rows_to_print,
+    "nodelta" => \$no_delta,
     "help" => sub { HelpMessage() },
 ) or die "Error in command line arguments";
 
 sub HelpMessage {
     print "Options:
-    --local  Use local data
-    --latest Fetch latest data
-    --notes  Print State Notes
-    --rows=i Number of rows to print (i is Integer)
-    --help   Print this help message
+    --local   Use local data
+    --latest  Fetch latest data
+    --notes   Print State Notes
+    --rows=i  Number of rows to print (i is Integer)
+    --nodelta Don't print changes in values
+    --help    Print this help message
 ";
     exit;
 }
@@ -187,7 +189,8 @@ foreach my $i ( 0 ... $rows_to_print - 1  ) {
         my $deaths = "$statewise->[$i]{deaths}";
 
         # Add delta only if it was updated Today.
-        if ( $update_info eq "Today" ) {
+        if ( $update_info eq "Today"
+                 and not $no_delta ) {
             $confirmed .= sprintf " (%+d)", $statewise->[$i]{deltaconfirmed};
             $recovered .= sprintf " (%+d)", $statewise->[$i]{deltarecovered};
             $deaths .= sprintf " (%+d)", $statewise->[$i]{deltadeaths};