Esempio n. 1
0
func (a *AnalyzerBase) ConfirmVersion(found bool, version string, defaultVersion string) string {
	message := fmt.Sprintf("Found %s version %s, confirm?", a.GetPack().Name(), version)
	if found && common.AskYesOrNo(message, true, a.ShouldPrompt) {
		return version
	}
	return common.AskUserWithDefault(fmt.Sprintf("Enter %s version:", a.GetPack().Name()), defaultVersion, a.ShouldPrompt)
}
Esempio n. 2
0
func (a *AnalyzerBase) AskForCommand(defaultCommand string, step string) string {
	confirmed := defaultCommand != "" && common.AskYesOrNo(fmt.Sprintf("This command will be run after each %s: '%s', confirm?", step, defaultCommand), true, a.ShouldPrompt)
	if confirmed {
		return defaultCommand
	} else {
		return common.AskUserWithDefault(fmt.Sprintf("Enter command to run after each %s:", step), "", a.ShouldPrompt)
	}
}
Esempio n. 3
0
func (a *Analyzer) findSettingsPy() (hasFound bool, path string) {
	hasFound, settingsModule := a.djangoSettingsModule()

	message := "Enter production settings file path"
	if hasFound {
		return true, filepath.Join(a.RootDir, common.AskUserWithDefault(message, a.module2File(settingsModule), a.ShouldPrompt))
	}
	if a.ShouldPrompt {
		return true, filepath.Join(a.RootDir, common.AskUser(message+" (e.g 'yourapp/settings.py')"))
	}
	return false, ""
}
Esempio n. 4
0
func (a *Analyzer) findRequirementsTxt() string {
	return common.AskUserWithDefault("Enter path to requirements file", "requirements.txt", a.ShouldPrompt)
}