fix: allow config to open broken env files
continuous-integration/drone/push Build is failing Details

Closes coop-cloud/organising#223.
This commit is contained in:
decentral1se 2021-11-02 14:38:53 +01:00
parent 31f6bd06a5
commit f2b02e39a7
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 17 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package app
import (
"errors"
"fmt"
"os"
"os/exec"
@ -17,7 +18,21 @@ var appConfigCommand = &cli.Command{
Aliases: []string{"c"},
Usage: "Edit app config",
Action: func(c *cli.Context) error {
app := internal.ValidateApp(c)
appName := c.Args().First()
if appName == "" {
internal.ShowSubcommandHelpAndError(c, errors.New("no app provided"))
}
files, err := config.LoadAppFiles("")
if err != nil {
logrus.Fatal(err)
}
appFile, exists := files[appName]
if !exists {
logrus.Fatalf("cannot find app with name '%s'", appName)
}
ed, ok := os.LookupEnv("EDITOR")
if !ok {
@ -30,7 +45,7 @@ var appConfigCommand = &cli.Command{
}
}
cmd := exec.Command(ed, app.Path)
cmd := exec.Command(ed, appFile.Path)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr