diff options
author | Andinus <andinus@nand.sh> | 2020-08-29 23:43:37 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-08-29 23:43:37 +0530 |
commit | b29e95f2b5016047ca22bbe56068ba75345f3518 (patch) | |
tree | 12718ee9700c83fc5533697f078529e7543b7bc8 /pyxis.pl | |
parent | 4fb6c9cae4e358d2ca2ad2874d569cd637ea9b0e (diff) | |
download | pyxis-b29e95f2b5016047ca22bbe56068ba75345f3518.tar.gz |
Allow loading multiple feeds, die if feed not present
Diffstat (limited to 'pyxis.pl')
-rwxr-xr-x | pyxis.pl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pyxis.pl b/pyxis.pl index 6f044fb..96e2e9f 100755 --- a/pyxis.pl +++ b/pyxis.pl @@ -68,11 +68,18 @@ my %dispatch = ( # If $ARGV[1] is passed then only load that feed. my @feeds; - $ARGV[1] - ? push @feeds, "$feeds_dir/$ARGV[1]" + + shift @ARGV; # Drop `timeline' from @ARGV. + + # Add all arguments to @feeds, this allows user to run `pyxis + # timeline f1 f2' & it'll load both `f1' & `f2'. But user can + # also type `pyxis timeline f1 f1' & it'll load `f1' twice. + scalar @ARGV + ? do {push @feeds, "$feeds_dir/$_" foreach @ARGV} : push @feeds, path($feeds_dir)->children; foreach my $feed (@feeds) { + die "pyxis: no such feed\n" unless -e $feed; for my $line ($feed->lines) { chomp $line; next if (substr($line, 0, 1) eq "#" |