Hello.

I'm following https://docs.raku.org/language/5to6-nutshell#Getopt::Long
but i still haven't figured it out how do i use a constraint in a
named parameter when processing a command line.

I have this piece of code:

multi sub MAIN("apt",
                :$layout where $layout ~~
/^<[12345]>\+[kk|1]$|^6\+$|^[studio|unusual]$/ #= Apartment layout.
Values accepted: 1+kk,2+kk,...,5+kk, 6+, studio, unusual
) {
    say "Enter";
}

however when i run it i get the --help message:

$ raku script.raku apt --layout '1+kk'
Usage:
  script.raku [--layout=<Any where { ... }>] apartment

  --layout=<Any where { ... }>    Apartment layout. Values accepted:
1+kk,2+kk,...,5+kk, 6+, studio, unusual


If i make layout a positional parameter then it works correctly. Is
there a way to make this work with a named parameter?
And how do i make possible to use the "--layout" option several times?
Changing the parameter from $layout to @layout doesn't work.



Best regards,
David Santiago

Reply via email to