forked from toolshed/abra
feat: auto-complete app and recipe names
This commit is contained in:
@ -177,6 +177,46 @@ func GetApps(appFiles AppFiles) ([]App, error) {
|
||||
return apps, nil
|
||||
}
|
||||
|
||||
func GetAppsNames() ([]string, error) {
|
||||
appFiles, err := LoadAppFiles("")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
apps, err := GetApps(appFiles)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var appNames []string
|
||||
for _, app := range apps {
|
||||
appNames = append(appNames, app.Name)
|
||||
}
|
||||
|
||||
return appNames, nil
|
||||
}
|
||||
|
||||
func GetDeployedApps() ([]string, error) {
|
||||
appFiles, err := LoadAppFiles("")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
apps, err := GetApps(appFiles)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
statuses, err := GetAppStatuses(appFiles)
|
||||
|
||||
var appNames []string
|
||||
for _, app := range apps {
|
||||
status := statuses[app.StackName()]
|
||||
if status == "deployed" {
|
||||
appNames = append(appNames, app.Name)
|
||||
}
|
||||
}
|
||||
|
||||
return appNames, nil
|
||||
}
|
||||
|
||||
// CopyAppEnvSample copies the example env file for the app into the users env files
|
||||
func CopyAppEnvSample(appType, appName, server string) error {
|
||||
envSamplePath := path.Join(ABRA_DIR, "apps", appType, ".env.sample")
|
||||
|
Reference in New Issue
Block a user