about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-06-14 17:56:08 +0530
committerAndinus <andinus@nand.sh>2020-06-14 17:56:08 +0530
commitd128d6030915dbed396e9232db389c5169705808 (patch)
treec6a52aceb4dfea1b23372e111e1603eb626754d0
parentf4d913540c00db5e87a1559c2d135402eb42e68b (diff)
downloadara-d128d6030915dbed396e9232db389c5169705808.tar.gz
Warn on invalid options instead of dying
-rwxr-xr-xara.pl12
1 files changed, 8 insertions, 4 deletions
diff --git a/ara.pl b/ara.pl
index f3d367c..9885950 100755
--- a/ara.pl
+++ b/ara.pl
@@ -8,7 +8,7 @@ use Time::Moment;
 use Text::ASCIITable;
 use Getopt::Long qw( GetOptions );
 use JSON::MaybeXS qw( decode_json );
-use Term::ANSIColor qw( :pushpop ) ;
+use Term::ANSIColor qw( :pushpop );
 
 use constant is_OpenBSD => $^O eq "openbsd";
 require OpenBSD::Unveil
@@ -42,6 +42,13 @@ GetOptions(
     "help", "h" => sub { HelpMessage() },
 ) or die "Error in command line arguments";
 
+if ( $use_local_file
+         and $get_latest ) {
+    warn LOCALCOLOR RED "Cannot use --local & --latest together
+Overriding --latest option";
+    undef $get_latest;
+}
+
 # To not break --nototal we add "India" to @to_hide.
 push @to_hide, "india"
     if $no_total;
@@ -79,9 +86,6 @@ sub HelpMessage {
     exit;
 }
 
-die "Can't use --local and --latest together\n"
-    if $use_local_file and $get_latest ;
-
 my $cache_dir = $ENV{XDG_CACHE_HOME} || "$ENV{HOME}/.cache";
 
 # %unveil contains list of paths to unveil with their permissions.