invalid input message
This commit is contained in:
		| @@ -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
									
									
								
							
							
						
						
									
										2
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							| @@ -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' | ||||||
|       ]) |       ]) | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -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 | ||||||
|   }, |   }, | ||||||
| ]); | ]); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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 { | ||||||
|   | |||||||
| @@ -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'); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user