fix: allow config to open broken env files
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Closes coop-cloud/organising#223.
This commit is contained in:
parent
31f6bd06a5
commit
f2b02e39a7
|
@ -1,6 +1,7 @@
|
||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -17,7 +18,21 @@ var appConfigCommand = &cli.Command{
|
||||||
Aliases: []string{"c"},
|
Aliases: []string{"c"},
|
||||||
Usage: "Edit app config",
|
Usage: "Edit app config",
|
||||||
Action: func(c *cli.Context) error {
|
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")
|
ed, ok := os.LookupEnv("EDITOR")
|
||||||
if !ok {
|
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.Stdin = os.Stdin
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
|
Loading…
Reference in New Issue