From b29e95f2b5016047ca22bbe56068ba75345f3518 Mon Sep 17 00:00:00 2001 From: Andinus Date: Sat, 29 Aug 2020 23:43:37 +0530 Subject: Allow loading multiple feeds, die if feed not present --- pyxis.pl | 11 +++++++++-- 1 file 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 "#" -- cgit 1.4.1-2-gfad0