fix: lake: leave run options for script (#3064)

Options passed to `lake script run <name>` / `lake run <name>` after the
`<name>` will now be properly passed on through to the script rather
than being consumed by Lake.

The issue was reported [on
Zulip](https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Lake.20script.20flag.20.22passthrough.22.3F/near/407734447).
This commit is contained in:
Mac Malone 2023-12-13 12:45:30 -05:00 committed by GitHub
parent b5b664e570
commit fbcfe6596e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

View file

@ -226,7 +226,7 @@ protected def list : CliM PUnit := do
IO.println script.name
protected nonrec def run : CliM PUnit := do
processOptions lakeOption
processLeadingOptions lakeOption -- between `lake [script] run` and `<name>`
let config ← mkLoadConfig (← getThe LakeOptions)
let ws ← loadWorkspace config
if let some spec ← takeArg? then

View file

@ -3,6 +3,7 @@ scripts/dismiss
scripts/greet
Hello, world!
Hello, me!
Hello, --me!
Display a greeting
USAGE:

View file

@ -11,6 +11,7 @@ $LAKE update
$LAKE script list | tee produced.out
$LAKE run /greet | tee -a produced.out
$LAKE script run greet me | tee -a produced.out
$LAKE script run greet --me | tee -a produced.out
$LAKE script doc greet | tee -a produced.out
$LAKE script run hello | tee -a produced.out
$LAKE script run dep/hello | tee -a produced.out