use REPL;
my constant raku-args = "-I" | "-M";

# Calling with Raku specific command line args
if @*ARGS.grep(*.starts-with(raku-args)) -> @raku-args {
    my $proc := run
      $*EXECUTABLE, @raku-args,
      $?FILE, @*ARGS.grep(!*.starts-with(raku-args)) || Empty;
    exit $proc.exitcode;
}

# No Raku specific command line args
@*ARGS = @*ARGS.grep(*.starts-with(<
  --editor
  --/header
  --/multi-line-ok
  --output-method
  --symbols
  --the-prompt
>.any));
@*ARGS.push: "--header" unless @*ARGS.first(*.ends-with("header"));
@*ARGS.push: "--next=";

# Cannot alias because we need the context to see imported classes
my $context := context;
sub MAIN(*%_) { repl(:$context, |%_) }

# vim: expandtab shiftwidth=4
