Skip to content

Commit

Permalink
Support a --cwd CLI option
Browse files Browse the repository at this point in the history
  • Loading branch information
bertdeblock committed Nov 24, 2024
1 parent 17c745b commit 90759d0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ yargs(hideBin(process.argv))
description: "Generate a class-based component",
type: "boolean",
})
.option("cwd", {
default: "",
description:
"Generate a component in a custom current working directory",
type: "string",
})
.option("path", {
default: "",
description: "Generate a component at a custom path",
Expand All @@ -40,6 +46,7 @@ yargs(hideBin(process.argv))
handler(options) {
generateComponent(options.name, {
classBased: options.classBased,
cwd: options.cwd,
path: options.path,
typescript: options.typescript,
});
Expand All @@ -62,6 +69,12 @@ yargs(hideBin(process.argv))
description: "Generate a class-based helper",
type: "boolean",
})
.option("cwd", {
default: "",
description:
"Generate a helper in a custom current working directory",
type: "string",
})
.option("path", {
default: "",
description: "Generate a helper at a custom path",
Expand All @@ -77,6 +90,7 @@ yargs(hideBin(process.argv))
handler(options) {
generateHelper(options.name, {
classBased: options.classBased,
cwd: options.cwd,
path: options.path,
typescript: options.typescript,
});
Expand All @@ -99,6 +113,12 @@ yargs(hideBin(process.argv))
description: "Generate a class-based modifier",
type: "boolean",
})
.option("cwd", {
default: "",
description:
"Generate a modifier in a custom current working directory",
type: "string",
})
.option("path", {
default: "",
description: "Generate a modifier at a custom path",
Expand All @@ -114,6 +134,7 @@ yargs(hideBin(process.argv))
handler(options) {
generateModifier(options.name, {
classBased: options.classBased,
cwd: options.cwd,
path: options.path,
typescript: options.typescript,
});
Expand All @@ -130,6 +151,12 @@ yargs(hideBin(process.argv))
description: "The service's name",
type: "string",
})
.option("cwd", {
default: "",
description:
"Generate a service in a custom current working directory",
type: "string",
})
.option("path", {
default: "",
description: "Generate a service at a custom path",
Expand All @@ -144,6 +171,7 @@ yargs(hideBin(process.argv))
},
handler(options) {
generateService(options.name, {
cwd: options.cwd,
path: options.path,
typescript: options.typescript,
});
Expand Down

0 comments on commit 90759d0

Please sign in to comment.