invalid input message

This commit is contained in:
Timo Hocker 2020-05-27 15:11:40 +02:00
parent d3322101ab
commit 1d2137feda
5 changed files with 10 additions and 4 deletions

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
## 1.6.0
option to change the message displayed on invalid input
## 1.5.0 ## 1.5.0
- added changelog - added changelog

2
Jenkinsfile vendored
View File

@ -5,7 +5,7 @@ pipeline {
VERSION = VersionNumber([ VERSION = VersionNumber([
versionNumberString: versionNumberString:
'${BUILDS_ALL_TIME}', '${BUILDS_ALL_TIME}',
versionPrefix: '1.5.', versionPrefix: '1.6.',
worstResultForIncrement: 'SUCCESS' worstResultForIncrement: 'SUCCESS'
]) ])
} }

View File

@ -1,6 +1,6 @@
# @sapphirecode/console-app # @sapphirecode/console-app
version: 1.5.x version: 1.6.x
read parameters from env, console args or interactively read parameters from env, console args or interactively
@ -29,7 +29,8 @@ const reader = new InteractiveOptions([
env: 'fooenv', // environment variable to read from (optional) env: 'fooenv', // environment variable to read from (optional)
description: 'the switch foo', // description in the help page (optional) description: 'the switch foo', // description in the help page (optional)
message: 'should foo be true?', // message when asking interactively (optional) message: 'should foo be true?', // message when asking interactively (optional)
preset: [] // preset choices for string and path types (optional) preset: [], // preset choices for string and path types (optional)
error: 'wrong input' // message to display when the user gives invalid input
}, },
]); ]);

View File

@ -18,6 +18,7 @@ interface Option {
description?: string; description?: string;
message?: string; message?: string;
preset?: unknown[]; preset?: unknown[];
error?: string;
} }
interface OptionProcess extends Option { interface OptionProcess extends Option {

View File

@ -86,7 +86,7 @@ export class InteractiveSource extends OptionSource {
throw e; throw e;
}); });
if (!opt.filled) if (!opt.filled)
console.log ('input was invalid'); console.log (opt.error || 'input was invalid');
} }
} }
} }