Skip to content

Commit 0d249dc

Browse files
authored
fix(cli): Only accept --dir, --env on grain run or grain (#2279)
1 parent 3cf6021 commit 0d249dc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cli/bin/grain.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ class GrainCommand extends commander.Command {
106106
num
107107
);
108108
cmd.forwardOption("--import-memory", "import the memory from `env.memory`");
109-
cmd.option("--dir <dir...>", "directory to preopen");
110-
cmd.option("--env <env...>", "WASI environment variables");
111109
cmd.forwardOption(
112110
"--elide-type-info",
113111
"don't include runtime type information used by toString/print"
@@ -176,6 +174,9 @@ program
176174
// `--version` should only be available on the default command
177175
.version(pkgJson.version, "-v, --version", "output the current version")
178176
.forwardOption("-o <filename>", "output filename")
177+
.option("--dir <dir...>", "directory to preopen")
178+
.option("--env <env...>", "WASI environment variables")
179+
179180
.action(function (file, options, program) {
180181
const success = exec.grainc(file, options, program);
181182
if (success) {
@@ -202,6 +203,8 @@ program
202203
program
203204
.command("run <file>")
204205
.description("run a wasm file via grain's WASI runner")
206+
.option("--dir <dir...>", "directory to preopen")
207+
.option("--env <env...>", "WASI environment variables")
205208
.action((...args) => exec.grainrun(unprocessedArgs, ...args));
206209

207210
program

0 commit comments

Comments
 (0)