lib/App/GHGen/Interactive.pm

filter: Statementstmt 100% 182 / 182 Branchbran 96.6% 29 / 30 Conditioncond 66.6% 8 / 12 MC/DCmcdc 50.0% 3 / 6 Subroutinesub 100% 18 / 18 Podpod 100% 5 / 5 totaltotal 96.8% 245 / 253 CC 27 SCAR 17.6
CC
27
Cov
98%
prompt_multiselect
11.1
prompt_choice
8.0
prompt_yes_no
6.0
CRAP 5.8
« lib/App/GHGen/Fixer.pm ↑ Summary lib/App/GHGen/Generator.pm »
1 package App::GHGen::Interactive;
2  
3 5 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use Term::ANSIColor qw(colored);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 our @EXPORT_OK = qw(
10 prompt_yes_no
11 prompt_choice
12 prompt_multiselect
13 prompt_text
14 customize_workflow
15 );
16  
17 5 our $VERSION = '0.12';
18  
19 =head1 NAME
20  
21 App::GHGen::Interactive - Interactive workflow customization
22  
23 =head1 SYNOPSIS
24  
25 use App::GHGen::Interactive qw(customize_workflow);
26  
27 my $config = customize_workflow('perl');
28 # Returns hash of user choices
29  
30 =encoding utf-8
31  
32 =head1 FUNCTIONS
33  
34 =head2 prompt_yes_no($question, $default)
35  
36 Prompt the user for a yes/no answer and return a boolean.
37  
38 =head3 Purpose
39  
40 Print C<$question> followed by a bracket hint (C<[Y/n]> or C<[y/N]>),
41 read one line from STDIN, and return C<1> for yes or C<0> for no. An
42 empty response uses C<$default>.
43  
44 =head3 Arguments
45  
46 =over 4
47  
48 =item C<$question> (Str, required)
49  
50 The question text to display.
51  
52 =item C<$default> (Str, optional, default C<'y'>)
53  
54 The default answer when the user presses Enter without typing.
55 Must be C<'y'> or C<'n'>.
56  
57 =back
58  
59 =head3 Returns
60  
61 C<1> when the answer is affirmative (C<y> or C<yes>, case-insensitive) or
62 when the empty response maps to a C<'y'> default.
63  
64 C<0> when the answer is negative (C<n> or C<no>, case-insensitive) or
65 when the empty response maps to an C<'n'> default.
66  
67 =head3 Side Effects
68  
69 Reads one line from STDIN; prints to STDOUT.
70  
71 =head3 Usage Example
72  
73 my $ok = prompt_yes_no("Enable coverage?", 'y');
74  
75 =head3 API SPECIFICATION
76  
77 =head4 Input
78  
79 {
80 question => { type => 'scalar', required => 1 },
81 default => { type => 'scalar', default => 'y' },
82 }
83  
84 =head4 Output
85  
86 { type => 'scalar' } # 1 or 0
87  
88 =head3 FORMAL SPECIFICATION
89  
90 prompt_yes_no : ℤ* × {'y','n'} → 𝔹
91  
92 answer ≔ chomp(readline(STDIN))
93 result ≔
94 answer =~ /^y(?:es)?$/i → 1
95 answer =~ /^n(?:o)?$/i → 0
96 answer = "" → default = 'y' → 1 | default = 'n' → 0
97  
98 =cut
99  
100 27 ▶sub prompt_yes_no($question, $default = 'y') {
Subroutine prompt_yes_no: called CC=6 SCAR=17.9
Pod documented
101 27 ▶ my $prompt = $default eq 'y' ? '[Y/n]' : '[y/N]';
Branch: 1 branch
BranchTrueFalseTotal
$default eq 'y' ? : 20 7 27
102 27 print "$question $prompt: ";
103 27 chomp(my $answer = <STDIN>);
104  
105 27 ▶ return 1 if $answer =~ /^y(?:es)?$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $answer =~ /^y(?:es)?$/iu 17 10 27
106 10 ▶ return 0 if $answer =~ /^n(?:o)?$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $answer =~ /^n(?:o)?$/iu 6 4 10
107 4 ▶ return $default eq 'y' ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$default eq 'y' ? : 2 2 4
108 }
109  
110 =head2 prompt_choice($question, $choices, $default)
111  
112 Prompt the user to select one item from a numbered list.
113  
114 =head3 Purpose
115  
116 Display C<$question> followed by a numbered list of C<$choices>, read one
117 line from STDIN, and return the zero-based index of the selected item.
118  
119 =head3 Arguments
120  
121 =over 4
122  
123 =item C<$question> (Str, required)
124  
125 The selection prompt text.
126  
127 =item C<$choices> (ArrayRef[Str], required)
128  
129 The available options, displayed numbered from 1.
130  
131 =item C<$default> (Int, optional, default C<0>)
132  
133 Zero-based index of the pre-selected option shown in the prompt.
134  
135 =back
136  
137 =head3 Returns
138  
139 A zero-based integer index. Returns C<$default> when the user presses Enter
140 without input or when the input is out of range (less than 1 or greater than
141 the number of choices).
142  
143 =head3 Side Effects
144  
145 Reads one line from STDIN; prints to STDOUT.
146  
147 =head3 Usage Example
148  
149 my $idx = prompt_choice("Package manager?", ['npm','yarn','pnpm'], 0);
150  
151 =head3 API SPECIFICATION
152  
153 =head4 Input
154  
155 {
156 question => { type => 'scalar', required => 1 },
157 choices => { type => 'arrayref', required => 1 },
158 default => { type => 'scalar', default => 0 },
159 }
160  
161 =head4 Output
162  
163 { type => 'scalar' } # integer 0 .. |choices|-1
164  
165 =head3 FORMAL SPECIFICATION
166  
167 prompt_choice : ℤ* × seq ℤ* × ℕ → ℕ
168  
169 answer ≔ chomp(readline(STDIN))
170 result ≔
171 answer = "" → default
172 answer ∈ ℕ ∧ 1 ≤ answer ≤ |choices| → answer − 1
173 otherwise → default
174  
175 =cut
176  
177 12 ▶sub prompt_choice($question, $choices, $default = 0) {
Subroutine prompt_choice: called CC=8 SCAR=20.8
Pod documented
178 12 say $question;
179 12 for my $i (0 .. $#$choices) {
180 36 ▶ my $marker = $i == $default ? colored(['green'], '→') : ' ';
Branch: 1 branch
BranchTrueFalseTotal
$i == $default ? : 12 24 36
181 36 say " $marker " . ($i + 1) . ". $choices->[$i]";
182 }
183  
184 12 print "\nEnter number [" . ($default + 1) . "]: ";
185 12 chomp(my $answer = <STDIN>);
186  
187 12 ▶ return $default if $answer eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $answer eq "" 3 9 12
188 9 ▶ return $answer - 1 if $answer =~ /^\d+$/ && $answer >= 1 && $answer <= @$choices;
Branch: 1 branch
BranchTrueFalseTotal
if $answer =~ /^\d+$/u and $answer >= 1 and $answer <= @$choices 5 4 9
Condition83%5/6
$answer =~ /^\d+$/u and $answer >= 1 and $answer <= @$choices
!ll&&!rl&&r
135
$answer =~ /^\d+$/u and $answer >= 1
!ll&&!rl&&r
018
MC/DC66%2/3
$answer =~ /^\d+$/u and $answer >= 1 and $answer <= @$choices
$answer =~ /^\d+$/u $answer >= 1 $answer <= @$choices
Truth table75%3/4
A and B and C
A= $answer =~ /^\d+$/uB= $answer >= 1C= $answer <= @$choices
ABCresult
0XX0
10X0
1100
1111
189 4 return $default;
190 }
191  
192 =head2 prompt_multiselect($question, $options, $defaults)
193  
194 Prompt the user to select zero or more items from a numbered list.
195  
196 =head3 Purpose
197  
198 Display C<$question> and a numbered list of C<$options>, accept
199 comma-separated numbers or the keyword C<all>, and return an array reference
200 of the selected option strings.
201  
202 =head3 Arguments
203  
204 =over 4
205  
206 =item C<$question> (Str, required)
207  
208 The multi-select prompt text.
209  
210 =item C<$options> (ArrayRef[Str], required)
211  
212 All available options, displayed numbered from 1.
213  
214 =item C<$defaults> (ArrayRef[Str], optional, default C<[]>)
215  
216 The pre-selected options (by value, not index).
217  
218 =back
219  
220 =head3 Returns
221  
222 An array reference of selected option strings. Possible values:
223  
224 =over 4
225  
226 =item *
227  
228 The full C<$options> list when the user types C<all>.
229  
230 =item *
231  
232 A subset derived from the comma/space-separated numbers the user entered.
233  
234 =item *
235  
236 C<$defaults> when the user presses Enter without typing.
237  
238 =back
239  
240 =head3 Side Effects
241  
242 Reads one line from STDIN; prints to STDOUT.
243  
244 =head3 Usage Example
245  
246 my $sel = prompt_multiselect("OS?", ['ubuntu-latest','macos-latest','windows-latest'], []);
247  
248 =head3 API SPECIFICATION
249  
250 =head4 Input
251  
252 {
253 question => { type => 'scalar', required => 1 },
254 options => { type => 'arrayref', required => 1 },
255 defaults => { type => 'arrayref', default => [] },
256 }
257  
258 =head4 Output
259  
260 { type => 'arrayref' }
261  
262 =head3 FORMAL SPECIFICATION
263  
264 prompt_multiselect : ℤ* × seq ℤ* × seq ℤ* → seq ℤ*
265  
266 answer ≔ chomp(readline(STDIN))
267 result ≔
268 answer = "" → defaults
269 answer =~ /^all$/i → options
270 otherwise → [ options[n−1] ∣ n ∈ split(/[,\s]+/, answer), 1 ≤ n ≤ |options| ]
271 ?? defaults (when result = ∅)
272  
273 =cut
274  
275 13 ▶sub prompt_multiselect($question, $options, $defaults = []) {
Subroutine prompt_multiselect: called CC=11 SCAR=24.0
Pod documented
276 13 say $question;
277 13 say colored(['cyan'], "(Enter numbers separated by commas, or 'all')");
278  
279 13 my %is_default = map { $_ => 1 } @$defaults;
280  
281 13 for my $i (0 .. $#$options) {
282 55 ▶ my $marker = $is_default{$options->[$i]} ? colored(['green'], '✓') : ' ';
Branch: 1 branch
BranchTrueFalseTotal
$is_default{$options->[$i]} ? : 25 30 55
283 55 say " $marker " . ($i + 1) . ". $options->[$i]";
284 }
285  
286 13 print "\nEnter choices [" . join(',', map { $_+1 } 0..$#$defaults) . "]: ";
287 13 chomp(my $answer = <STDIN>);
288  
289 13 ▶ return $defaults if $answer eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $answer eq "" 2 11 13
290  
291 11 ▶ if ($answer =~ /^all$/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($answer =~ /^all$/iu) 2 9 11
292 2 return $options;
293 }
294  
295 9 my @selected;
296 9 for my $num (split /[,\s]+/, $answer) {
297 19 ▶ if ($num =~ /^\d+$/ && $num >= 1 && $num <= @$options) {
Branch: 1 branch
BranchTrueFalseTotal
if ($num =~ /^\d+$/u and $num >= 1 and $num <= @$options) 17 2 19
Condition50%3/6
$num =~ /^\d+$/u and $num >= 1 and $num <= @$options
!ll&&!rl&&r
0217
$num =~ /^\d+$/u and $num >= 1
!ll&&!rl&&r
0019
MC/DC33%1/3
$num =~ /^\d+$/u and $num >= 1 and $num <= @$options
$num =~ /^\d+$/u $num >= 1 $num <= @$options
Truth table50%2/4
A and B and C
A= $num =~ /^\d+$/uB= $num >= 1C= $num <= @$options
ABCresult
0XX0
10X0
1100
1111
298 17 push @selected, $options->[$num - 1];
299 }
300 }
301  
302 9 ▶ return @selected ? \@selected : $defaults;
Branch: 1 branch
BranchTrueFalseTotal
@selected ? : 8 1 9
303 }
304  
305 =head2 prompt_text($question, $default)
306  
307 Prompt the user for a free-form text answer.
308  
309 =head3 Purpose
310  
311 Display C<$question> optionally followed by C<[$default]>, read one line
312 from STDIN, and return the user's answer or C<$default> when empty.
313  
314 =head3 Arguments
315  
316 =over 4
317  
318 =item C<$question> (Str, required)
319  
320 The prompt text.
321  
322 =item C<$default> (Str, optional, default C<''>)
323  
324 Returned as-is when the user presses Enter without typing anything.
325  
326 =back
327  
328 =head3 Returns
329  
330 The trimmed line the user typed, or C<$default> when the input is empty.
331  
332 =head3 Side Effects
333  
334 Reads one line from STDIN; prints to STDOUT.
335  
336 =head3 Usage Example
337  
338 my $name = prompt_text("Project name", 'my-project');
339  
340 =head3 API SPECIFICATION
341  
342 =head4 Input
343  
344 {
345 question => { type => 'scalar', required => 1 },
346 default => { type => 'scalar', default => '' },
347 }
348  
349 =head4 Output
350  
351 { type => 'scalar' }
352  
353 =head3 FORMAL SPECIFICATION
354  
355 prompt_text : ℤ* × ℤ* → ℤ*
356  
357 answer ≔ chomp(readline(STDIN))
358 result ≔ answer = "" → default | otherwise → answer
359  
360 =cut
361  
362 15 ▶sub prompt_text($question, $default = '') {
Subroutine prompt_text: called CC=4 SCAR=13.9
Pod documented
363 15 ▶ my $prompt = $default ? "[$default]" : '';
Branch: 1 branch
BranchTrueFalseTotal
$default ? : 15 0 15
364 15 print "$question $prompt: ";
365 15 chomp(my $answer = <STDIN>);
366  
367 15 ▶ return $answer eq '' ? $default : $answer;
Branch: 1 branch
BranchTrueFalseTotal
$answer eq '' ? : 2 13 15
368 }
369  
370 =head2 customize_workflow($type)
371  
372 Drive an interactive customization session for the given workflow type.
373  
374 =head3 Purpose
375  
376 Display a series of prompts relevant to C<$type> and collect user preferences.
377 Dispatches to a private C<_customize_*> helper; returns an empty hash when
378 the type is not supported.
379  
380 =head3 Arguments
381  
382 =over 4
383  
384 =item C<$type> (Str, required)
385  
386 The workflow type to customise. Supported: C<perl>, C<node>, C<python>,
387 C<rust>, C<go>, C<ruby>, C<docker>, C<static>.
388  
389 =back
390  
391 =head3 Returns
392  
393 A hash reference of configuration key/value pairs collected from the user.
394 Returns an empty hash reference (C<{}>) when C<$type> is not recognised.
395  
396 =head3 Side Effects
397  
398 Reads multiple lines from STDIN; prints to STDOUT.
399  
400 =head3 Usage Example
401  
402 my $config = customize_workflow('perl');
403 # $config->{enable_critic}, $config->{perl_versions}, etc.
404  
405 =head3 API SPECIFICATION
406  
407 =head4 Input
408  
409 { type => { type => 'scalar', required => 1 } }
410  
411 =head4 Output
412  
413 { type => 'hashref' } # empty or populated with type-specific keys
414  
415 =head3 FORMAL SPECIFICATION
416  
417 SupportedCustomTypes ≔ { perl, node, python, rust, go, ruby, docker, static }
418  
419 customize_workflow : ℤ* → Config
420  
421 t ∈ SupportedCustomTypes → _customize_t()
422 t ∉ SupportedCustomTypes → {}
423  
424 =cut
425  
426 10 ▶sub customize_workflow($type) {
Subroutine customize_workflow: called CC=2 SCAR=6.9
Pod documented
427 10 say '';
428 10 say colored(['bold cyan'], "=== Workflow Customization: " . uc($type) . " ===");
429 10 say '';
430  
431 10 my %dispatch = (
432 perl => \&_customize_perl,
433 node => \&_customize_node,
434 python => \&_customize_python,
435 rust => \&_customize_rust,
436 go => \&_customize_go,
437 ruby => \&_customize_ruby,
438 docker => \&_customize_docker,
439 static => \&_customize_static,
440 );
441  
442 10 ▶ if (exists $dispatch{$type}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $dispatch{$type}) 8 2 10
443 8 return $dispatch{$type}->();
444 }
445  
446 2 return {};
447 }
448  
449 1 ▶sub _customize_perl() {
Subroutine _customize_perl: called CC=1 SCAR=0.0
450 1 my %config;
451  
452 # Perl versions
453 1 say colored(['bold'], "Perl Versions to Test:");
454 1 my @all_versions = qw(5.40 5.38 5.36 5.34 5.32 5.30 5.28 5.26 5.24 5.22);
455 1 my @default_versions = qw(5.40 5.38 5.36);
456  
457 1 $config{perl_versions} = prompt_multiselect(
458 "Which Perl versions?",
459 \@all_versions,
460 \@default_versions
461 );
462 1 say '';
463  
464 # Operating systems
465 1 say colored(['bold'], "Operating Systems:");
466 1 my @all_os = ('ubuntu-latest', 'macos-latest', 'windows-latest');
467 1 my @default_os = @all_os;
468  
469 1 $config{os} = prompt_multiselect(
470 "Which operating systems?",
471 \@all_os,
472 \@default_os
473 );
474 1 say '';
475  
476 # Code quality
477 1 say colored(['bold'], "Code Quality Tools:");
478 1 $config{enable_linter} = prompt_yes_no(
479 "Enable syntax linting (perl -c on all matrix cells)?",
480 'y'
481 );
482 1 say '';
483  
484 1 $config{enable_linter_unused} = prompt_yes_no(
485 "Enable unused-variable check (warnings::unused, latest+ubuntu only)?",
486 'n'
487 );
488 1 say '';
489  
490 1 $config{enable_critic} = prompt_yes_no(
491 "Enable Perl::Critic?",
492 'y'
493 );
494 1 say '';
495  
496 # Coverage
497 1 $config{enable_coverage} = prompt_yes_no(
498 "Enable test coverage (Devel::Cover)?",
499 'y'
500 );
501 1 say '';
502  
503 # Branches
504 1 say colored(['bold'], "Branch Configuration:");
505 1 my $branches = prompt_text(
506 "Branches to run on (comma-separated)",
507 'main,master'
508 );
509 1 $config{branches} = [split /,\s*/, $branches];
510 1 say '';
511  
512 1 return \%config;
513 }
514  
515 1 ▶sub _customize_node() {
Subroutine _customize_node: called CC=1 SCAR=0.0
516 1 my %config;
517  
518 # Node versions
519 1 say colored(['bold'], "Node.js Versions to Test:");
520 1 my @all_versions = qw(18.x 20.x 22.x 23.x);
521 1 my @default_versions = qw(20.x 22.x);
522  
523 1 $config{node_versions} = prompt_multiselect(
524 "Which Node.js versions?",
525 \@all_versions,
526 \@default_versions
527 );
528 1 say '';
529  
530 # Package manager
531 1 say colored(['bold'], "Package Manager:");
532 1 my $pm_choice = prompt_choice(
533 "Which package manager?",
534 ['npm', 'yarn', 'pnpm'],
535 0
536 );
537 1 $config{package_manager} = ['npm', 'yarn', 'pnpm']->[$pm_choice];
538 1 say '';
539  
540 # Linting
541 1 $config{enable_lint} = prompt_yes_no(
542 "Enable linting?",
543 'y'
544 );
545 1 say '';
546  
547 # Build step
548 1 $config{enable_build} = prompt_yes_no(
549 "Enable build step?",
550 'y'
551 );
552 1 say '';
553  
554 # Branches
555 1 my $branches = prompt_text(
556 "Branches to run on (comma-separated)",
557 'main,develop'
558 );
559 1 $config{branches} = [split /,\s*/, $branches];
560 1 say '';
561  
562 1 return \%config;
563 }
564  
565 1 ▶sub _customize_python() {
Subroutine _customize_python: called CC=1 SCAR=0.0
566 1 my %config;
567  
568 # Python versions
569 1 say colored(['bold'], "Python Versions to Test:");
570 1 my @all_versions = qw(3.9 3.10 3.11 3.12 3.13);
571 1 my @default_versions = qw(3.11 3.12);
572  
573 1 $config{python_versions} = prompt_multiselect(
574 "Which Python versions?",
575 \@all_versions,
576 \@default_versions
577 );
578 1 say '';
579  
580 # Linting
581 1 say colored(['bold'], "Code Quality:");
582 1 $config{enable_flake8} = prompt_yes_no(
583 "Enable flake8 linting?",
584 'y'
585 );
586 1 say '';
587  
588 1 $config{enable_black} = prompt_yes_no(
589 "Enable black formatter check?",
590 'n'
591 );
592 1 say '';
593  
594 # Coverage
595 1 $config{enable_coverage} = prompt_yes_no(
596 "Enable test coverage?",
597 'y'
598 );
599 1 say '';
600  
601 # Branches
602 1 my $branches = prompt_text(
603 "Branches to run on (comma-separated)",
604 'main,develop'
605 );
606 1 $config{branches} = [split /,\s*/, $branches];
607 1 say '';
608  
609 1 return \%config;
610 }
611  
612 1 ▶sub _customize_rust() {
Subroutine _customize_rust: called CC=1 SCAR=0.0
613 1 my %config;
614  
615 1 say colored(['bold'], "Rust Workflow Options:");
616  
617 1 $config{enable_fmt} = prompt_yes_no(
618 "Enable formatting check (cargo fmt)?",
619 'y'
620 );
621 1 say '';
622  
623 1 $config{enable_clippy} = prompt_yes_no(
624 "Enable clippy linting?",
625 'y'
626 );
627 1 say '';
628  
629 1 $config{enable_release} = prompt_yes_no(
630 "Build release binary?",
631 'y'
632 );
633 1 say '';
634  
635 1 my $branches = prompt_text(
636 "Branches to run on (comma-separated)",
637 'main'
638 );
639 1 $config{branches} = [split /,\s*/, $branches];
640 1 say '';
641  
642 1 return \%config;
643 }
644  
645 1 ▶sub _customize_go() {
Subroutine _customize_go: called CC=1 SCAR=0.0
646 1 my %config;
647  
648 1 say colored(['bold'], "Go Workflow Options:");
649  
650 1 my $go_version = prompt_text(
651 "Go version",
652 '1.22'
653 );
654 1 $config{go_version} = $go_version;
655 1 say '';
656  
657 1 $config{enable_vet} = prompt_yes_no(
658 "Enable go vet?",
659 'y'
660 );
661 1 say '';
662  
663 1 $config{enable_race} = prompt_yes_no(
664 "Enable race detector?",
665 'y'
666 );
667 1 say '';
668  
669 1 $config{enable_coverage} = prompt_yes_no(
670 "Enable test coverage?",
671 'y'
672 );
673 1 say '';
674  
675 1 my $branches = prompt_text(
676 "Branches to run on (comma-separated)",
677 'main'
678 );
679 1 $config{branches} = [split /,\s*/, $branches];
680 1 say '';
681  
682 1 return \%config;
683 }
684  
685 1 ▶sub _customize_ruby() {
Subroutine _customize_ruby: called CC=1 SCAR=0.0
686 1 my %config;
687  
688 1 say colored(['bold'], "Ruby Versions to Test:");
689 1 my @all_versions = qw(3.1 3.2 3.3);
690 1 my @default_versions = qw(3.2 3.3);
691  
692 1 $config{ruby_versions} = prompt_multiselect(
693 "Which Ruby versions?",
694 \@all_versions,
695 \@default_versions
696 );
697 1 say '';
698  
699 1 my $branches = prompt_text(
700 "Branches to run on (comma-separated)",
701 'main'
702 );
703 1 $config{branches} = [split /,\s*/, $branches];
704 1 say '';
705  
706 1 return \%config;
707 }
708  
709 1 ▶sub _customize_docker() {
Subroutine _customize_docker: called CC=1 SCAR=0.0
710 1 my %config;
711  
712 1 say colored(['bold'], "Docker Workflow Options:");
713  
714 1 my $image_name = prompt_text(
715 "Docker image name (user/image)",
716 'your-username/your-image'
717 );
718 1 $config{image_name} = $image_name;
719 1 say '';
720  
721 1 $config{push_on_pr} = prompt_yes_no(
722 'Push images on pull requests?',
723 'n'
724 );
725 1 say '';
726  
727 1 my $branches = prompt_text(
728 "Branches to run on (comma-separated)",
729 'main'
730 );
731 1 $config{branches} = [split /,\s*/, $branches];
732 1 say '';
733  
734 1 return \%config;
735 }
736  
737 1 ▶sub _customize_static() {
Subroutine _customize_static: called CC=1 SCAR=0.0
738 1 my %config;
739  
740 1 say colored(['bold'], "Static Site Deployment:");
741  
742 1 my $build_dir = prompt_text('Build output directory', './public');
743 1 $config{build_dir} = $build_dir;
744 1 say '';
745  
746 1 my $build_command = prompt_text("Build command", 'npm run build');
747 1 $config{build_command} = $build_command;
748 1 say '';
749  
750 1 return \%config;
751 }
752  
753 =head1 AUTHOR
754  
755 Nigel Horne E<lt>njh@nigelhorne.comE<gt>
756  
757 L<https://github.com/nigelhorne>
758  
759 =head1 COPYRIGHT AND LICENSE
760  
761 Copyright 2025-2026 Nigel Horne.
762  
763 Usage is subject to the GPL2 licence terms.
764 If you use it,
765 please let me know.
766  
767 =cut
768  
769 5 1;
« lib/App/GHGen/Fixer.pm ↑ Summary lib/App/GHGen/Generator.pm »