Skip to content

Commit 9336aa8

Browse files
committed
feat: add script to print one menu command
1 parent 62f9c29 commit 9336aa8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
use strict;
2+
use warnings;
3+
4+
my ($nameWidth, $helpWidth, $helpHeight, $name, $help) = @ARGV;
5+
6+
my $format;
7+
my $delimiter = $help eq "" ? "" : "-";
8+
9+
sub getFormat {
10+
my $line1 = " @@{['<' x $nameWidth]}@|^@{['<' x $helpWidth]}";
11+
my $line2 = "\$name, \$delimiter, \$help";
12+
my $line3 = "~@{[' ' x ($nameWidth + 4)]}^@{['<' x $helpWidth]}";
13+
my $line4 = "\$help";
14+
15+
$format = <<EOF;
16+
format FORMAT_COMMAND =
17+
$line1
18+
$line2
19+
@{["$line3\n$line4\n" x ($helpHeight - 1)]}.
20+
EOF
21+
}
22+
23+
getFormat();
24+
25+
eval($format);
26+
27+
select(STDOUT);
28+
$~ = "FORMAT_COMMAND";
29+
write;

0 commit comments

Comments
 (0)