refactor: use app getting instead of boilerplate

This commit is contained in:
2021-09-05 23:17:35 +02:00
parent 48bcc9cb36
commit d4333c2dc0
18 changed files with 111 additions and 266 deletions

View File

@ -22,7 +22,7 @@ var appCpCommand = &cli.Command{
ArgsUsage: "<src> <dst>",
Usage: "Copy files to/from a running app service",
Action: func(c *cli.Context) error {
appName := internal.ValidateAppNameArg(c)
app := internal.ValidateApp(c)
src := c.Args().Get(1)
dst := c.Args().Get(2)
@ -67,14 +67,13 @@ var appCpCommand = &cli.Command{
logrus.Fatal(err)
}
appEnv, err := config.GetApp(appFiles, appName)
appEnv, err := config.GetApp(appFiles, app.Name)
if err != nil {
logrus.Fatal(err)
}
ctx := context.Background()
server := appFiles[appName].Server
cl, err := client.New(server)
cl, err := client.New(app.Server)
if err != nil {
logrus.Fatal(err)
}