invalid input message
This commit is contained in:
		| @@ -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
									
									
								
							
							
						
						
									
										2
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							| @@ -5,7 +5,7 @@ pipeline { | ||||
|       VERSION = VersionNumber([ | ||||
|           versionNumberString: | ||||
|               '${BUILDS_ALL_TIME}', | ||||
|           versionPrefix: '1.5.', | ||||
|           versionPrefix: '1.6.', | ||||
|           worstResultForIncrement: 'SUCCESS' | ||||
|       ]) | ||||
|   } | ||||
|   | ||||
| @@ -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 | ||||
|   }, | ||||
| ]); | ||||
|  | ||||
|   | ||||
| @@ -18,6 +18,7 @@ interface Option { | ||||
|   description?: string; | ||||
|   message?: string; | ||||
|   preset?: unknown[]; | ||||
|   error?: string; | ||||
| } | ||||
|  | ||||
| interface OptionProcess extends Option { | ||||
|   | ||||
| @@ -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'); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user