File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed
Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ export const jsonCreation = async function (
5656 }
5757}
5858
59- export const inputString = async function (
59+ export const inputStrings = async function (
6060 userName : string ,
6161 defaults : string ,
6262 optional : boolean ,
@@ -89,6 +89,31 @@ export const inputString = async function (
8989 return { ...takeInput }
9090}
9191
92+ export async function inputString (
93+ name : string ,
94+ defaults : string ,
95+ optional : boolean ,
96+ message = ""
97+ ) {
98+ const takeInput = await inquirer . prompt ( {
99+ type : "input" ,
100+ name,
101+ message,
102+ validate : ( value ) => {
103+ if ( name === "path" ) {
104+ return apipathpattern . test ( value ) || "Please enter a valid path" ;
105+ } else if ( envpattern . test ( name ) ) {
106+ return ( value !== "" && value !== undefined ) || "Environment values cannot be empty" ;
107+ } else {
108+ return optional || stringpattern . test ( value ) || `${ message } should have only alphanumeric values` ;
109+ }
110+ } ,
111+ } ) ;
112+
113+ return { ...takeInput } ;
114+ }
115+
116+
92117export const languageChoice = async function ( ) {
93118 const lang = await inquirer . prompt ( [
94119 {
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ import * as util from "./cliUtil"
1616let moreStack
1717export async function roverADD ( ) {
1818 const app_name = await util . inputString ( "app_name" , "" , false , "App Name:" )
19- await rover_helpers . samValidate ( app_name [ "app_name" ] )
20- await rover_helpers . checkFile ( app_name [ "app_name" ] , "yes" )
19+ await rover_helpers . samValidate ( < string > app_name [ "app_name" ] )
20+ await rover_helpers . checkFile ( < string > app_name [ "app_name" ] , "yes" )
2121 const language = await util . languageChoice ( )
2222 const file_name = await exec ( `ls ${ app_name [ "app_name" ] } /*.yaml ` ) . toString ( )
2323 const CompStacks = await rover_helpers . checkNested ( file_name )
@@ -58,7 +58,7 @@ async function CustomObject(i: number) {
5858 `Stack ${ i } Name: `
5959 )
6060 const CustomStacks = await util . multichoice ( "app_type" , choice , "" )
61- customStacks [ customstack_name [ `customStackName${ i } ` ] ] = CustomStacks . app_type
61+ customStacks [ < string > customstack_name [ `customStackName${ i } ` ] ] = CustomStacks . app_type
6262 return customStacks
6363}
6464export async function createModules (
You can’t perform that action at this time.
0 commit comments