diff --git a/CHANGELOG.md b/CHANGELOG.md index af6d2d4..bede47e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.6.0 + +option to change the message displayed on invalid input + ## 1.5.0 - added changelog diff --git a/Jenkinsfile b/Jenkinsfile index 92f12d7..a057651 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { VERSION = VersionNumber([ versionNumberString: '${BUILDS_ALL_TIME}', - versionPrefix: '1.5.', + versionPrefix: '1.6.', worstResultForIncrement: 'SUCCESS' ]) } diff --git a/README.md b/README.md index 7ce7256..22396b3 100644 --- a/README.md +++ b/README.md @@ -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 }, ]); diff --git a/lib/Option.ts b/lib/Option.ts index 967dc66..2d5a77e 100644 --- a/lib/Option.ts +++ b/lib/Option.ts @@ -18,6 +18,7 @@ interface Option { description?: string; message?: string; preset?: unknown[]; + error?: string; } interface OptionProcess extends Option { diff --git a/lib/Sources/InteractiveSource.ts b/lib/Sources/InteractiveSource.ts index 6b46480..d3d2368 100644 --- a/lib/Sources/InteractiveSource.ts +++ b/lib/Sources/InteractiveSource.ts @@ -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'); } } }