// SelectModels asks user which models and methods to generate
SelectModels asks user which models and methods to generate
// SelectModels asks user which models and methods to generate
func SelectModels() (selectedModels []SelectedModel) {
	shell := ishell.New()
	shell.Println("Generating migrations")
	files, err := ioutil.ReadDir("models")
	if err != nil {
		fmt.Println(err)
	}
	var fileNames []string
	for _, file := range files {
		fileNames = append(fileNames, strings.Title(inflector.Singularize(strings.TrimRight(file.Name(), ".go"))))
	}
	choices := shell.Checklist(fileNames,
		"Please select models you want to generate the matching store:",
		nil)
	if len(choices) == 0 {
		shell.Println("Please choose at least one model (by pressing spacebar on each one you want to select)")
		return nil
	}
	for _, file := range choices {
		var selectedModel SelectedModel
		selectedModel.ModelName = FirstCharUpper(inflector.Pluralize(fileNames[file]))
		selectedModels = append(selectedModels, selectedModel)
	}
	return selectedModels
}
func SelectModels ( ) ( selectedModels [ ] SelectedModel ) { shell := ishell . New ( ) shell . Println ( " " ) files , err := ioutil . ReadDir ( " " ) if err != nil { fmt . Println ( err ) } var fileNames [ ] string for _ , file := range files { fileNames = append ( fileNames , strings . Title ( inflector . Singularize ( strings . TrimRight ( file . Name ( ) , " " ) ) ) ) } choices := shell . Checklist ( fileNames , " " , nil ) if len ( choices ) == 0 { shell . Println ( " " ) return nil } for _ , file := range choices { var selectedModel SelectedModel selectedModel . ModelName = FirstCharUpper ( inflector . Pluralize ( fileNames [ file ] ) ) selectedModels = append ( selectedModels , selectedModel ) } return selectedModels }
SelectModels asks user which models and methods to generate
SelectModels asks user which models and methods to generate
// Step 1: Ask user which models to use