This commit is contained in:
random 2025-01-19 12:35:41 -05:00
parent fa2870c4b3
commit 99fc573b3c

View file

@ -61,21 +61,24 @@ sub HandleArgs
if (defined $opt->{sopt})
{
if (grep { $_ eq $opt->{sopt} } @soptlist)
if (grep { $_ eq $opt->{sopt} // () } @soptlist)
{
die "Option -$opt->{sopt} cannot be in a list as it requires an argument!\n"
if $opt->{arg} eq "required";
$opt->{handler}();
}
elsif (defined $+{sopt} and $+{sopt} // "" eq $opt->{sopt})
# will make these look better later
elsif (defined $+{sopt} and defined $+{sopt}
and $+{sopt} eq $opt->{sopt})
{
$optarg = $+{optarg} // ();
$opt->{handler}($optarg);
}
}
if (defined $opt->{lopt} and $+{lopt} // "" eq $opt->{lopt})
if (defined $opt->{lopt} and defined $+{lopt}
and $+{lopt} eq $opt->{lopt})
{
$optarg = $+{optarg} // ();
$opt->{handler}($optarg);