Skip to content
Permalink
Browse files

Make ARGS-TO-CAPTURE also take the MAIN as the first argument

Apparently some GetOpt modules use the information of the MAIN sub
to build up structures needed for parsing the arguments.  The default
ARGS-TO-CAPTURE does not do that at the moment.
  • Loading branch information...
lizmat committed Oct 10, 2018
1 parent 33c2415 commit 8c3a41310683b699a7c1b380bdf42a5151ec3d62
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/Main.pm6
@@ -13,7 +13,7 @@ my sub MAIN_HELPER($IN-as-ARGSFILES, $retval = 0) {
my %SUB-MAIN-OPTS := %*SUB-MAIN-OPTS // {};

# Convert raw command line args into positional and named args for MAIN
my sub ARGS-TO-CAPTURE(@args is copy --> Capture:D) {
my sub ARGS-TO-CAPTURE($, @args is copy --> Capture:D) {
my $no-named-after = nqp::isfalse(%SUB-MAIN-OPTS<named-anywhere>);

my $positional := nqp::create(IterationBuffer);
@@ -224,7 +224,7 @@ my sub MAIN_HELPER($IN-as-ARGSFILES, $retval = 0) {

# Process command line arguments
my $capture :=
(callframe(1).my<&ARGS-TO-CAPTURE> // &ARGS-TO-CAPTURE)(@*ARGS);
(callframe(1).my<&ARGS-TO-CAPTURE> // &ARGS-TO-CAPTURE)($main, @*ARGS);

# Generate default $?USAGE message
my $usage;

0 comments on commit 8c3a413

Please sign in to comment.
You can’t perform that action at this time.