about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-08-29 23:31:08 +0530
committerAndinus <andinus@nand.sh>2020-08-29 23:31:08 +0530
commitb9778e3478c3ccf8ab27710ee996d1e853a40555 (patch)
tree9018b6f8ddf043d003556cb35daf56e0c8ccafb4
parent6ffa05dd88a81b862ae69fbc422ddb0785f58a2b (diff)
downloadpyxis-b9778e3478c3ccf8ab27710ee996d1e853a40555.tar.gz
Allow user to select single feeds
Now user can run `pyxis timeline <feed>' & it'll only load that feed.
-rwxr-xr-xpyxis.pl11
1 files changed, 9 insertions, 2 deletions
diff --git a/pyxis.pl b/pyxis.pl
index 3077281..6f044fb 100755
--- a/pyxis.pl
+++ b/pyxis.pl
@@ -60,12 +60,19 @@ my %dispatch = (
             my $res = $http->mirror($url, $file);
             $res->{success}
                 ? do {say "$feed updated" if $options{verbose}}
-                : warn "failed to fetch $feed - $url\n$!\n"
+                : warn "failed to fetch $feed - $url\n$!\n";
         }
     },
     timeline => sub {
         my %twtxt;
-        foreach my $feed (path($feeds_dir)->children) {
+
+        # If $ARGV[1] is passed then only load that feed.
+        my @feeds;
+        $ARGV[1]
+            ? push @feeds, "$feeds_dir/$ARGV[1]"
+            : push @feeds, path($feeds_dir)->children;
+
+        foreach my $feed (@feeds) {
             for my $line ($feed->lines) {
                 chomp $line;
                 next if (substr($line, 0, 1) eq "#"