diff options
author | Andinus <andinus@nand.sh> | 2020-08-27 15:01:13 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-08-27 15:01:13 +0530 |
commit | 42b3e462cb676dafa469b393c1b60211e69f91d4 (patch) | |
tree | c43d5ff28ec63dfba544ffe00d6ab97ba3f89b74 | |
parent | eeb6cb006e4053bf56658ccaadde5ba17933f8d9 (diff) | |
download | leo-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.
-rwxr-xr-x | leo.pl | 17 |
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", @_]; } |