Skip to content

Commit 157cad9

Browse files
committed
feat: add skip-options option
1 parent 3d2198e commit 157cad9

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

git-consistent

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ const setOptions = (program, definitions, terms) => {
3636

3737
const createProgram = (program, definitions, terms) => {
3838
return setOptions(program, definitions, terms)
39-
.option(`-d, --dry-run` , 'run dry-run mode')
40-
.option(`-i, --interactive`, 'run interactive mode')
39+
.option(`-d, --dry-run`, 'run dry-run mode', false)
40+
.option(`-i, --interactive`, 'run interactive mode', false)
41+
.option(`-s, --skip-options`, 'skip not required term input (interactive mode only)', false)
4142
.version(version)
4243
.parse(process.argv)
4344
}
@@ -109,7 +110,11 @@ const replaceTerm = (program, template, definition, term) => {
109110

110111
if (program.interactive) {
111112
if (_.isUndefined(value)) {
112-
value = input(term, definition)
113+
if (definition.required || !program.skipOptions) {
114+
value = input(term, definition)
115+
} else {
116+
value = ''
117+
}
113118
while (definition.required && _.isEmpty(value)) {
114119
console.log(`${term} is required`)
115120
value = input(term, definition)

0 commit comments

Comments
 (0)