| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
| |
Initial commit message was "Remove useless line", that line would feel
bad so I changed it. I think it got left out when I moved from each to
foreach.
|
| |
|
|
|
|
|
| |
Warning about not hiding notes column will only print if user passed
--notes.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It would've printed something like:
Name "HTTP::Simple::UA" used only once: possible typo at
/home/andinus/projects/scripts/ara line 121.
Error in tempfile() using template
https:/api.covid19india.org/XXXXXXXXXX: Parent
directory (https:/api.covid19india.org/) does not exist at
/home/andinus/perl5/lib/perl5/HTTP/Simple.pm line 69.
Grinnz on #perl (freenode.net) said:
probably because HTTP::Simple isn't loaded until runtime, that
warning is pretty stupid
it's a workaround for before they had proper lexical variables to
work with that can detect typoes correctly
|
|
|
|
|
|
|
| |
Till now the local option was actually useless, this enforces it.
The program will only not respect local option if the file doesn't
exist. Otherwise in all cases it shall respect the option.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The issue with ctime is that it doesn't change & stays the same as
when the file was actually created, this means the code was running
the if block basically everytime after 8 minutes of file creation.
And I couldn't use mtime because HTTP::Tiny's mirror method stores
mtime as 'Last Modified' header.
This switch to HTTP::Simple will download the file everytime which
means the mtime changes & we can make the program not look for file
every time. However this also means that we are downloading the whole
file everytime instead of only when it changes. Meh... It's okay
because the alternative is to write a complicated logic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Only hiding "State" & "Notes" column is forbidden & will print a
warning for the user.
I should also optimize other parts, like it still creates $deaths &
does all related calulations even if we hide that column.
And for @columns part, #perl (freenode.net) suggested some other
methods too but later we found out they were all broken (logical
error), the solutions were nice though & so I'm recording them here.
I could've created a %fields hash like this:
my %fields = ( State => 1 ... );
And then I would delete the things that user wants to hide:
delete $fields{s/\b(\w)/\U$1/gr} for keys %hide;
Either like that or like this:
delete @fields{ map ucfirst, keys %hide };
Then just used keys %fields in setCols().
Issue with the first delete method is that it's complicated & I didn't
understand it so I wasn't going to use it anyways.
Issue with the second delete method is that it wouldn't have worked
with "Last Updated" field because there is a space in between, ucfirst
function would've only capitalized 'L' of "Last".
Even if I understood the first method or somehow fix the second method
all this still wont work because keys %fields would get me columns in
random order which isn't what I want.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The behaviour was broken because previously it wouldn't have printed
as many rows as user had entered because of other options.
For example, say if user ran `ara --rows 2 --hide india`, previously
this would've printed only 1 row because "India" is always the first
row & the foreach loop would've looped only two times so
$rows_to_print was more like number of rows to iterate over.
Now it does what it says, it prints that many number of rows.
|
| |
|
| |
|
|
|
|
| |
I could also extend this to hiding columns.
|
| |
|
|
|
|
| |
This also tunes the colors a bit.
|
| |
|
|
|
|
| |
I decided it looks better without colors.
|
|
|
|
|
|
|
|
|
|
|
| |
Colors in deltas will be changed as they increase or decrease. Maybe I
should define colors with some magic math, I'll think about it. For
now this is good enough. Currently it's 19:00 here & states haven't
yet updated the records so I don't see any colors, I'll see them in
action at night when they're updated.
I should remove colors from Last Updated column maybe because it's not
that helpful, almost all states update daily.
|
|
|
|
|
|
|
|
|
|
| |
sub declarations are decided on compile time irrespective of
surrounding if blocks so unveil sub was getting overriden by { return
1; } everytime which means that basically unveil wasn't running at
all.
And this is why I should've written tests or maybe even add a debug
flag that would warn each time custom unveil is called.
|
| |
|
|
|
|
|
|
|
|
| |
This will fail if user doesn't has the path in @INC which might be
possible on custom Perl install. I'll add a note about this in README.
This is good for non-OpenBSD users as now the program will run on
their system without any changes.
|
|
|
|
| |
"nodelta" flag will not print any delta changes.
|
|
|
|
| |
This includes unix specific code & should be mentioned in README.
|
|
|
|
|
| |
This does the same thing as the if block, I also applied it to all
three values because "why not?". sprintf handles this cleanly.
|
| |
|
|
|
|
|
|
|
|
| |
HTTP::Tiny sets mtime to "Last Modified" time set by the server. ctime
is set as the time when that file gets created on disk so we use that
to compare now, actually this should've been used from the start but
File::Fetch didn't set mtime differently (?) so mtime worked till we
used File::Fetch.
|
|
|
|
| |
While not perfect this is a lot better than the old list.
|
|
|
|
| |
HTTP::Tiny has more options.
|
|
|
|
|
| |
"State Unassigned" had deltaconfirmed of -773 today which showed up as
"+-773".
|
|
|
|
| |
Looks like many like this style, looks good to me too.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Example output will change all the time & I also added new things like
State Notes so better just remove it instead of creating huge diffs
for every new function. Instead I added a demo video which users can
watch.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
User can now specify the number of rows to print. It'll print all the
rows if --notes is passed or if $rows evaluates to false or if the
user passed value greater than the length of Array.
It'll now warn the user if file doesn't exist locally & user has
passed --local, also instead of just dying it fetches the file from
the web instead.
$covid_19_data not doesn't get printed if --notes is passed. We assume
that the user either wants to see notes or $covid_19_data.
|
| |
|
| |
|
|
|
|
| |
Instead of using 2 modules we switch everything to Text:ASCIITable.
|
| |
|
|
|
|
|
|
|
| |
After removing all DateTime code it took ~0.98s to run, before that it
was ~1.2s. And after removing 'use DateTime' it now takes ~0.30s to
run, all of this is without File::Fetch part, it loaded the data from
disk instead of fetching.
|
|
|
|
|
| |
No need to convert it to string for comparision, we instead use == to
compare numbers.
|
|
|
|
|
|
|
|
|
| |
First step to replacing DateTime with Time::Moment, DateTime is very
huge, no need to load that large module for simple tasks, it'll also
make the program run faster.
This comparison happens in utc time instead of converting it to other
time zone which was meaningless anyways.
|
|
|
|
|
| |
'use File::Fetch' gets processed at compile time so we use 'require
File::Fetch' instead.
|
| |
|
|
|
|
|
|
| |
Text::Table::Tiny wasn't good for state notes because they were long &
had characters like '\n'. Text::ASCIITable has nice options to work
with these.
|
| |
|