Skip to content

Commit 66b3094

Browse files
committed
Merge branch 'fix/113-boolean-cli-flags'
2 parents f16f90c + 90e5e5f commit 66b3094

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

apps/generator-cli/src/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ Initially the file has the following content:
120120
This configuration indicates the following:
121121

122122
- the json file shall be formatted using **2 spaces**
123+
- the jar files shall be downloaded to *./my/custom/storage/dir*
123124
- the generator-cli version 4.3.1 is used
124125

125126
Further it is also possible to configure generators, for example:
@@ -130,7 +131,8 @@ Further it is also possible to configure generators, for example:
130131
"spaces": 2,
131132
"generator-cli": {
132133
"version": "4.3.1",
133-
"generators": {
134+
"storageDir": "~/my/custom/storage/dir", // optional
135+
"generators": { // optional
134136
"v2.0": { // any name you like (just printed to the console log)
135137
"generatorName": "typescript-angular",
136138
"output": "#{cwd}/output/v2.0/#{ext}/#{name}",

apps/generator-cli/src/app/services/generator.service.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe('GeneratorService', () => {
138138
`--rel-dir="def/app"`,
139139
`--rel-path="def/app/pet.yaml"`,
140140
`--ext="yaml"`,
141-
'--some-bool=true',
141+
'--some-bool',
142142
'--some-int=1',
143143
]),
144144
cmd('[baz] def/app/car.json', [
@@ -152,20 +152,20 @@ describe('GeneratorService', () => {
152152
`--rel-dir="def/app"`,
153153
`--rel-path="def/app/car.json"`,
154154
`--ext="json"`,
155-
'--some-bool=true',
155+
'--some-bool',
156156
'--some-int=1',
157157
]),
158158
]],
159159
['bar.json', [
160160
cmd('[bar] api/cat.yaml', [
161161
`--input-spec="${cwd}/api/cat.yaml"`,
162162
`--output="bar/cat"`,
163-
'--some-bool=false',
163+
'--some-bool',
164164
]),
165165
cmd('[bar] api/bird.json', [
166166
`--input-spec="${cwd}/api/bird.json"`,
167167
`--output="bar/bird"`,
168-
'--some-bool=false',
168+
'--some-bool',
169169
]),
170170
]],
171171
['none.json', []],

apps/generator-cli/src/app/services/generator.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,17 @@ export class GeneratorService {
9090
switch (typeof v) {
9191
case 'object':
9292
return `"${Object.entries(v).map(z => z.join('=')).join(',')}"`
93-
case 'boolean':
9493
case 'number':
9594
case 'bigint':
9695
return `${v}`
96+
case 'boolean':
97+
return undefined
9798
default:
9899
return `"${v}"`
99100
}
100101
})()
101102

102-
return `--${key}=${value}`
103+
return value === undefined ? `--${key}` : `--${key}=${value}`
103104
}).join(' ')
104105

105106
const ext = path.extname(absoluteSpecPath)

0 commit comments

Comments
 (0)