fix: implement config-export hook
This will allow dropping many of the "source config/functions" calls littered over the codebase. Plugin triggers are the way to perform cross-plugin communication :)
This commit is contained in:
@@ -33,38 +33,7 @@ func CommandClear(appName string, global bool, noRestart bool) error {
|
||||
|
||||
// CommandExport implements config:export
|
||||
func CommandExport(appName string, global bool, merged bool, format string) error {
|
||||
appName, err := getAppNameOrGlobal(appName, global)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
env := getEnvironment(appName, merged)
|
||||
exportType := ExportFormatExports
|
||||
suffix := "\n"
|
||||
|
||||
exportTypes := map[string]ExportFormat{
|
||||
"exports": ExportFormatExports,
|
||||
"envfile": ExportFormatEnvfile,
|
||||
"docker-args": ExportFormatDockerArgs,
|
||||
"docker-args-keys": ExportFormatDockerArgsKeys,
|
||||
"shell": ExportFormatShell,
|
||||
"pretty": ExportFormatPretty,
|
||||
"json": ExportFormatJSON,
|
||||
"json-list": ExportFormatJSONList,
|
||||
}
|
||||
|
||||
exportType, ok := exportTypes[format]
|
||||
if !ok {
|
||||
return fmt.Errorf("Unknown export format: %v", format)
|
||||
}
|
||||
|
||||
if exportType == ExportFormatShell {
|
||||
suffix = " "
|
||||
}
|
||||
|
||||
exported := env.Export(exportType)
|
||||
fmt.Print(exported + suffix)
|
||||
return nil
|
||||
return export(appName, global, merged, format)
|
||||
}
|
||||
|
||||
// CommandGet implements config:get
|
||||
|
||||
Reference in New Issue
Block a user