1 Commits
1.1.0 ... main

Author SHA1 Message Date
Simon Lecoq
01d2a38824 feat: support pass all args syntax 2023-11-08 05:51:34 +00:00
3 changed files with 23 additions and 0 deletions

5
mod.ts
View File

@@ -449,6 +449,11 @@ export function command(
) => [key, options.default]),
),
})
if (parseArgv) {
raw = raw.replaceAll("$<*>", argv.join(" "))
} else if (colors) {
raw = raw.replaceAll("$<*>", italic(underline("$<*>")))
}
for (let i = 0; i < args.length; i++) {
const { alias, required, default: defaults } = args[i]
if (parseArgv) {

View File

@@ -57,6 +57,20 @@ Deno.test("deno task make: missing args required throw", async () => {
.rejectedWith(Error, /missing argument/i)
})
Deno.test("deno task make: pass all arguments", async () => {
const stdio = [] as string[]
const { code } = await make({
task: "make:args_pass_all",
argv: ["--foo", "🦕", "🦖"],
config: "tests/deno_make.jsonc",
log: (message) => stdio.push(message),
stdio: "piped",
exit: false,
})
expect(stdio.join("\n")).to.include("--foo").to.include("🦕").and.to.include("🦖")
expect(code).to.equal(0)
})
Deno.test("deno task make: flags", async () => {
const stdio = [] as string[]
const { code } = await make({

View File

@@ -37,6 +37,10 @@
}
]
},
"make:args_pass_all": {
"task": "echo '$<*>'",
"cwd": "tests"
},
"make:flags": {
"task": "echo '$<foo> / $<bar>'",
"cwd": "tests",