Created
May 23, 2023 15:01
-
-
Save exodist/c6fdba0d651f7b9001a033018f8f2e38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub cli_docs { | |
my $self = shift; | |
my @forms = $self->doc_forms; | |
require App::Yath::Util; | |
require Test2::Util::Term; | |
my $width = Test2::Util::Term::term_size() - 20; | |
$width = 80 unless $width && $width >= 80; | |
my @out; | |
push @out => App::Yath::Util::fit_to_width($width, ", ", \@forms); | |
my $desc = App::Yath::Util::fit_to_width($width, " ", $self->{+DESCRIPTION}); | |
$desc =~ s/^/ /gm; | |
push @out => $desc; | |
push @out => "\n Can also be set with the following environment variables: " . join(", ", @{$self->{+FROM_ENV_VARS}}) if $self->{+FROM_ENV_VARS}; | |
push @out => "\n The following environment variables will be cleared after arguments are processed: " . join(", ", @{$self->{+CLEAR_ENV_VARS}}) if $self->{+CLEAR_ENV_VARS}; | |
push @out => "\n The following environment variables will be set after arguments are processed: " . join(", ", @{$self->{+SET_ENV_VARS}}) if $self->{+SET_ENV_VARS}; | |
if (my $notes = $self->notes) { | |
push @out => "\n Note: $notes"; | |
} | |
s/\s+$//gsm for @out; | |
return join "\n" => @out; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# +-------------------------------+----+-------------------------------+ | |
# | GOT | OP | CHECK | | |
# +-------------------------------+----+-------------------------------+ | |
[...] | |
# | --auto-list, --auto-list=A | | --auto-list, --auto-list=A | | |
# | RG, -L, -L=ARG, --no-auto- | | RG, -L, -L=ARG, --no-auto- | | |
# | list\n | | list\n | | |
# | an auto list\n | | an auto list\n | | |
# | \n | | \n | | |
# | Note: Can be specified mu | | Note: Can be specified mu | | |
# | ltiple times\n | | ltiple times\n | | |
[...] | |
Line 9 has whitespace before the \n in the "GOT" value. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment