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
## 1.6.0
option to change the message displayed on invalid input
## 1.5.0
- added changelog

2
Jenkinsfile vendored
View File

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

View File

@ -1,6 +1,6 @@
# @sapphirecode/console-app
version: 1.5.x
version: 1.6.x
read parameters from env, console args or interactively
@ -29,7 +29,8 @@ const reader = new InteractiveOptions([
env: 'fooenv', // environment variable to read from (optional)
description: 'the switch foo', // description in the help page (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;
message?: string;
preset?: unknown[];
error?: string;
}
interface OptionProcess extends Option {

View File

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