From fe4185f11c7b1733c9a2193012a3c88f664c4d19 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Thu, 20 Apr 2023 03:01:38 +0200 Subject: [PATCH] delete option --all-effect and process it with option --all --- bin/color.pl | 102 ++++++++++++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 55 deletions(-) diff --git a/bin/color.pl b/bin/color.pl index 28796341..d8b3b226 100755 --- a/bin/color.pl +++ b/bin/color.pl @@ -12,46 +12,46 @@ my $VERSION = '0.0.2'; ############################################################################### my ($NAME) = $0 =~ m#([^/]+)$#; my %BG = ( - 'black' => 40, - 'red' => 41, - 'green' => 42, - 'yellow' => 43, - 'blue' => 44, - 'magenta' => 45, - 'cyan' => 46, - 'white' => 47, - 'default' => 49, + 'black' => 40, + 'red' => 41, + 'green' => 42, + 'yellow' => 43, + 'blue' => 44, + 'magenta' => 45, + 'cyan' => 46, + 'white' => 47, + 'default' => 49, ); my %FG = ( - 'black' => 30, - 'red' => 31, - 'green' => 32, - 'yellow' => 33, - 'blue' => 34, - 'magenta' => 35, - 'cyan' => 36, - 'white' => 37, - 'default' => 39, + 'black' => 30, + 'red' => 31, + 'green' => 32, + 'yellow' => 33, + 'blue' => 34, + 'magenta' => 35, + 'cyan' => 36, + 'white' => 37, + 'default' => 39, ); my %EFFECT = ( - 'none' => 0, - 'bold' => 1, - 'pale' => 2, - 'evidence' => 3, - 'underline' => 4, - 'blink' => 5, - 'invert' => 7, - 'cache' => 8, - 'normal' => 22, - 'no_evidence' => 23, - 'no_souligne' => 24, - 'no_underline' => 24, - 'no_clignotant' => 25, - 'no_blink' => 25, - 'no_inverse' => 27, - 'no_invert' => 27, + 'none' => 0, + 'bold' => 1, + 'pale' => 2, + 'evidence' => 3, + 'underline' => 4, + 'blink' => 5, + 'invert' => 7, + 'cache' => 8, + 'normal' => 22, + 'no_evidence' => 23, + 'no_souligne' => 24, + 'no_underline' => 24, + 'no_clignotant' => 25, + 'no_blink' => 25, + 'no_inverse' => 27, + 'no_invert' => 27, ); ############################################################################### # V A L E U R P A R D E F A U T @@ -77,7 +77,6 @@ use Getopt::Long qw(:config default no_ignore_case); my %Opt; ,'effect|ef=s' ,'print-num|n!' ,'all|a!' - ,'all-effect|ae!' ) || exit -1; &help() if $Opt{'help'}; &version() if $Opt{'version'}; @@ -97,7 +96,19 @@ if ($Opt{all}) { my $length = length($input)+3; - print "Forgrounds:\n"; + print "\nEffect:\n"; + for my $e (sort keys %EFFECT) { + my $e_num = $EFFECT{$e}; + + printf "%21s", "$e ($e_num) | "; + + print in_color($input,{ + effect => $e, + num => $PRINT_CODE, + }),"\n"; + } + + print "\nForgrounds:\n"; for my $fg (sort keys %FG) { my $fg_num = $FG{$fg}; @@ -128,25 +139,6 @@ if ($Opt{all}) { exit 0; } -if ($Opt{'all-effect'}) { - - my $length = length($input)+3; - - print "\nEffect:\n"; - for my $e (sort keys %EFFECT) { - my $e_num = $EFFECT{$e}; - - printf "%21s", "$e ($e_num) | "; - - print in_color($input,{ - effect => $e, - num => $PRINT_CODE, - }),"\n"; - } - - exit 0; -} - print in_color($input,{ fg => $FG, bg => $BG, -- 2.47.3