Skip to content

Commit cb9bb65

Browse files
committed
Fix white space
1 parent ed0e648 commit cb9bb65

File tree

4 files changed

+415
-415
lines changed

4 files changed

+415
-415
lines changed

bin/random-string

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,54 @@ our $VERSION = '0.02';
1010

1111
# Parse command line options
1212
my %opts = (
13-
count => 1,
14-
length => undef,
15-
smart => 0,
16-
unique => 0,
17-
separator => "\n",
18-
help => 0,
19-
man => 0,
20-
version => 0,
21-
examples => 0,
13+
count => 1,
14+
length => undef,
15+
smart => 0,
16+
unique => 0,
17+
separator => "\n",
18+
help => 0,
19+
man => 0,
20+
version => 0,
21+
examples => 0,
2222
);
2323

2424
GetOptions(
25-
'count|c=i' => \$opts{count},
26-
'length|l=i' => \$opts{length},
27-
'smart|s' => \$opts{smart},
28-
'unique|u' => \$opts{unique},
29-
'separator|S=s' => \$opts{separator},
30-
'help|h|?' => \$opts{help},
31-
'man|m' => \$opts{man},
32-
'version|v' => \$opts{version},
33-
'examples|e' => \$opts{examples},
25+
'count|c=i' => \$opts{count},
26+
'length|l=i' => \$opts{length},
27+
'smart|s' => \$opts{smart},
28+
'unique|u' => \$opts{unique},
29+
'separator|S=s' => \$opts{separator},
30+
'help|h|?' => \$opts{help},
31+
'man|m' => \$opts{man},
32+
'version|v' => \$opts{version},
33+
'examples|e' => \$opts{examples},
3434
) or pod2usage(2);
3535

3636
# Handle special options
3737
if ($opts{version}) {
38-
print "random-string version $VERSION\n";
39-
exit 0;
38+
print "random-string version $VERSION\n";
39+
exit 0;
4040
}
4141

4242
pod2usage(1) if $opts{help};
4343
pod2usage(-exitval => 0, -verbose => 2) if $opts{man};
4444

4545
if ($opts{examples}) {
46-
show_examples();
47-
exit 0;
46+
show_examples();
47+
exit 0;
4848
}
4949

5050
# Get the pattern from command line
5151
my $pattern = shift @ARGV;
5252

5353
unless (defined $pattern) {
54-
print STDERR "Error: Pattern required\n\n";
55-
pod2usage(1);
54+
print STDERR "Error: Pattern required\n\n";
55+
pod2usage(1);
5656
}
5757

5858
# Validate options
5959
if ($opts{count} < 1) {
60-
die "Error: count must be at least 1\n";
60+
die 'Error: count must be at least 1';
6161
}
6262

6363
# Decode escape sequences in separator
@@ -68,25 +68,25 @@ $opts{separator} =~ s/\\0/\0/g;
6868

6969
# Create generator
7070
my $gen = eval {
71-
Data::Random::String::Matches->new($pattern, $opts{length});
71+
Data::Random::String::Matches->new($pattern, $opts{length});
7272
};
7373

7474
if ($@) {
75-
die "Error creating generator: $@\n";
75+
die "Error creating generator: $@";
7676
}
7777

7878
# Generate strings
7979
my @results;
8080
for (1 .. $opts{count}) {
81-
my $str = eval {
82-
$opts{smart} ? $gen->generate_smart() : $gen->generate();
83-
};
84-
85-
if ($@) {
86-
die "Error generating string: $@\n";
87-
}
88-
89-
push @results, $str;
81+
my $str = eval {
82+
$opts{smart} ? $gen->generate_smart() : $gen->generate();
83+
};
84+
85+
if ($@) {
86+
die "Error generating string: $@";
87+
}
88+
89+
push @results, $str;
9090
}
9191

9292
# Output results
@@ -96,7 +96,7 @@ print "\n" unless $opts{separator} =~ /\n$/;
9696
exit 0;
9797

9898
sub show_examples {
99-
print <<'EXAMPLES';
99+
print <<'EXAMPLES';
100100
Examples:
101101
102102
# Generate a single 4-digit number
@@ -133,14 +133,14 @@ Examples:
133133
random-string '[A-Z]{3}\d{4}' -c 100 --smart
134134
135135
Common patterns:
136-
\d{4} - 4-digit PIN
137-
[A-Z]{2}\d{3} - License plate style
138-
\d{3}-\d{3}-\d{4} - Phone number
139-
[a-z]+@[a-z]+\.com - Simple email
140-
[A-Fa-f0-9]{32} - MD5 hash
141-
[A-Za-z0-9]{20} - Random token
142-
(foo|bar|baz) - One of three options
143-
(\w{4})-\1 - Repeated pattern
136+
\d{4} - 4-digit PIN
137+
[A-Z]{2}\d{3} - License plate style
138+
\d{3}-\d{3}-\d{4} - Phone number
139+
[a-z]+@[a-z]+\.com - Simple email
140+
[A-Fa-f0-9]{32} - MD5 hash
141+
[A-Za-z0-9]{20} - Random token
142+
(foo|bar|baz) - One of three options
143+
(\w{4})-\1 - Repeated pattern
144144
145145
EXAMPLES
146146
}
@@ -156,14 +156,14 @@ random-string - Generate random strings matching a regular expression
156156
random-string [options] PATTERN
157157
158158
Options:
159-
-c, --count N Generate N strings (default: 1)
160-
-l, --length N Set length for fallback generation (default: 10)
161-
-s, --smart Use smart generation only (faster)
162-
-S, --separator STR Separator between outputs (default: newline)
163-
-e, --examples Show usage examples
164-
-h, --help Show brief help
165-
-m, --man Show full manual
166-
-v, --version Show version
159+
-c, --count N Generate N strings (default: 1)
160+
-l, --length N Set length for fallback generation (default: 10)
161+
-s, --smart Use smart generation only (faster)
162+
-S, --separator STR Separator between outputs (default: newline)
163+
-e, --examples Show usage examples
164+
-h, --help Show brief help
165+
-m, --man Show full manual
166+
-v, --version Show version
167167
168168
=head1 DESCRIPTION
169169
@@ -221,42 +221,42 @@ Print version information and exit.
221221
222222
=head2 Character Classes
223223
224-
[a-z] Lowercase letters
225-
[A-Z] Uppercase letters
226-
[0-9] Digits
227-
[abc] Specific characters
228-
[^a-z] Negated class
224+
[a-z] Lowercase letters
225+
[A-Z] Uppercase letters
226+
[0-9] Digits
227+
[abc] Specific characters
228+
[^a-z] Negated class
229229
230230
=head2 Escape Sequences
231231
232-
\d Digit [0-9]
233-
\w Word character [a-zA-Z0-9_]
234-
\s Whitespace
235-
\D Non-digit
236-
\W Non-word character
232+
\d Digit [0-9]
233+
\w Word character [a-zA-Z0-9_]
234+
\s Whitespace
235+
\D Non-digit
236+
\W Non-word character
237237
\t \n \r Tab, newline, carriage return
238238
239239
=head2 Quantifiers
240240
241-
{n} Exactly n times
242-
{n,m} Between n and m times
243-
{n,} At least n times
244-
+ One or more
245-
* Zero or more
246-
? Zero or one
241+
{n} Exactly n times
242+
{n,m} Between n and m times
243+
{n,} At least n times
244+
+ One or more
245+
* Zero or more
246+
? Zero or one
247247
248248
=head2 Groups and Alternation
249249
250-
(...) Capturing group
251-
(?:...) Non-capturing group
252-
| Alternation (cat|dog)
253-
\1 \2 Backreferences
250+
(...) Capturing group
251+
(?:...) Non-capturing group
252+
| Alternation (cat|dog)
253+
\1 \2 Backreferences
254254
255255
=head2 Other
256256
257-
. Any character
258-
^ Start anchor (stripped)
259-
$ End anchor (stripped)
257+
. Any character
258+
^ Start anchor (stripped)
259+
$ End anchor (stripped)
260260
261261
=head1 EXAMPLES
262262

0 commit comments

Comments
 (0)