about summary refs log tree commit diff stats
path: root/leo.pl
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-08-27 15:01:13 +0530
committerAndinus <andinus@nand.sh>2020-08-27 15:01:13 +0530
commit42b3e462cb676dafa469b393c1b60211e69f91d4 (patch)
treec43d5ff28ec63dfba544ffe00d6ab97ba3f89b74 /leo.pl
parenteeb6cb006e4053bf56658ccaadde5ba17933f8d9 (diff)
downloadleo-42b3e462cb676dafa469b393c1b60211e69f91d4.tar.gz
Parse @ARGV to catch all arguments
Now the user can run ``leo pass journal'' & both will be archived,
previously `journal' would've been ignored.
Diffstat (limited to 'leo.pl')
-rwxr-xr-xleo.pl17
1 files changed, 10 insertions, 7 deletions
diff --git a/leo.pl b/leo.pl
index a2656a4..f2361f4 100755
--- a/leo.pl
+++ b/leo.pl
@@ -120,13 +120,16 @@ Options:
     --verbose};
 }
 
-if ( $ARGV[0] and $dispatch{ $ARGV[0] } ) {
-    path($archive_dir)->mkpath; # Create archive directory.
-    $dispatch{ $ARGV[0] }->();
-} elsif ( scalar @ARGV == 0 ) {
-    HelpMessage();
-} else {
-    die say "leo: no such option\n";
+HelpMessage() if scalar @ARGV == 0;
+
+path($archive_dir)->mkpath; # Create archive directory.
+foreach my $arg ( @ARGV ) {
+    say "--------------------------------";
+    if ( $dispatch{ $arg } ) {
+        $dispatch{ $arg }->();
+    } else {
+        die say "leo: no such option\n";
+    }
 }
 
 sub tar_create { run3 ["/bin/tar", "cf", @_]; }