Skip to content

Commit 288e964

Browse files
committed
Fix passing arguments to generator
1 parent ff3e79c commit 288e964

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 4.16.2
4+
* Bug: Fix passing arguments to generator
5+
36
## 4.16.1
47
* Chore: (GUI) Updated to SvelteKit 2 and Vite 5
58
* Chore: (GUI) Updated naming in GraphQL requests

bin/pos-cli-generate-run.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const installModulesAndLoadGenerator = (generatorPath, generatorName) => {
3737

3838
const runYeoman = async (generatorPath, attributes, options) => {
3939
const generatorName = registerGenerator(generatorPath);
40-
const generatorArgs = compact([generatorName, attributes]);
40+
const generatorArgs = compact([generatorName].concat(attributes));
4141
await yeomanEnv.run(generatorArgs, options);
4242
}
4343

@@ -104,17 +104,18 @@ const description = `Run generator
104104
program
105105
.name('pos-cli generate')
106106
.description(description)
107-
.arguments('<generatorPath> [generatorAttributes]', 'path to the generator directory')
107+
.arguments('<generatorPath>', 'path to the generator directory')
108+
.argument('[generatorArguments...]', 'generator arguments')
108109
.option('--generator-help', 'show help for given generator')
109110
.allowUnknownOption()
110-
.usage("<generatorPath> [generatorAttributes]", 'arguments that will be passed to the generator')
111-
.action(async function (generatorPath, generatorAttributes, options, command) {
111+
.usage("<generatorPath> <generatorArguments...>", 'arguments that will be passed to the generator')
112+
.action(async function (generatorPath, generatorArguments, options, command) {
112113
try{
113114
if (options.generatorHelp){
114115
showHelpForGenerator(generatorPath);
115116
} else {
116117
const extraOptions = unknownOptions(command);
117-
await runYeoman(generatorPath, generatorAttributes, extraOptions);
118+
await runYeoman(generatorPath, generatorArguments, extraOptions);
118119
}
119120
} catch (e) {
120121
logger.Error(`Error: ${e.message}`, { exit: false });

0 commit comments

Comments
 (0)