From 42b3e462cb676dafa469b393c1b60211e69f91d4 Mon Sep 17 00:00:00 2001 From: Andinus Date: Thu, 27 Aug 2020 15:01:13 +0530 Subject: Parse @ARGV to catch all arguments Now the user can run ``leo pass journal'' & both will be archived, previously `journal' would've been ignored. --- leo.pl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'leo.pl') 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", @_]; } -- cgit 1.4.1-2-gfad0