diff options
author | EuAndreh <eu@euandre.org> | 2019-01-05 10:38:38 -0200 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2019-01-05 10:39:06 -0200 |
commit | 55e947d7901c17dbb1365a5cfb9f40acd50e903b (patch) | |
tree | 4e2a7db1001ccf64073824d907afaabf2e69ae91 /website | |
parent | Add BATS tests to CLI usage and basic interactions. (diff) | |
download | euandre.org-55e947d7901c17dbb1365a5cfb9f40acd50e903b.tar.gz euandre.org-55e947d7901c17dbb1365a5cfb9f40acd50e903b.tar.xz |
Print CLI errors using Term::ANSIColor.
Diffstat (limited to 'website')
-rwxr-xr-x | website | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -37,6 +37,7 @@ use warnings; use Getopt::Long qw(:config no_ignore_case bundling pass_through); use Pod::Usage qw(pod2usage); use File::Basename qw(dirname); +use Term::ANSIColor; my $help = 0; my $title = ''; @@ -47,7 +48,7 @@ sub getopts { } sub test { - die "FIXME"; + print colored("FIXME", "red"), "\n"; } sub escaped_cmd { @@ -68,10 +69,10 @@ sub dispatch { -exitval => 0 ); } elsif (!defined $action) { - print "Missing subcommand.\n"; pod2usage( -verbose => 1, - -exitval => 2 + -exitval => 2, + -message => colored("Missing subcommand.", "red") ); } elsif ($action eq 'pastebin') { my @sub_args = grep { $_ ne $action } @args; @@ -82,10 +83,10 @@ sub dispatch { } elsif ($action eq 'test') { test(); } else { - print "Unknown subcommand: $action.\n"; pod2usage( -verbose => 1, - -exitval => 2 + -exitval => 2, + -message => colored("Unknown subcommand: $action.", "red") ); } } |