Skip to content
This repository was archived by the owner on Mar 30, 2020. It is now read-only.

Commit 0ba8745

Browse files
committed
Added --upper/--lower flags.
1 parent e4b5b50 commit 0ba8745

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

expand-ipv6

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ expand-ipv6 - Expand IPv6 addresses to their full width.
1111
Command-Line Options:
1212
1313
--bare Don't show the colons in the output.
14+
--lower Show all alphabetical characters in lower-case.
1415
--help Show the help-information for this script.
16+
--upper Show all alphabetical characters in upper-case.
1517
1618
=cut
1719

@@ -75,6 +77,9 @@ while ( my $addr = shift )
7577
$expanded =~ s/://g;
7678
}
7779

80+
$expanded = lc($expanded) if ( $config{'lc'} ) ;
81+
$expanded = uc($expanded) if ( $config{'uc'} ) ;
82+
7883
# Show the necessary.
7984
print $expanded . "\n";
8085
}
@@ -151,10 +156,16 @@ sub parsedOptions
151156
exit
152157
if (
153158
!GetOptions( "help" => \$vars{ 'help' },
154-
"bare" => \$vars{ 'bare' }, ) );
159+
"bare" => \$vars{ 'bare' },
160+
"lower" => \$vars{ 'lc' },
161+
"upper" => \$vars{ 'uc' },
162+
) );
155163

156164
pod2usage(1) if ( $vars{ 'help' } );
157165

166+
# If we have no default use lower-case
167+
$vars{'lc'} = 1 unless( $vars{'lc'} || $vars{'uc'} );
168+
158169
return (%vars);
159170

160171
}

0 commit comments

Comments
 (0)