refactor: centralise app name validation
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -2,7 +2,6 @@ package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
abraFormatter "coopcloud.tech/abra/cli/formatter"
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
@ -34,10 +33,7 @@ var appVolumeListCommand = &cli.Command{
|
||||
Usage: "list volumes associated with an app",
|
||||
Aliases: []string{"ls"},
|
||||
Action: func(c *cli.Context) error {
|
||||
appName := c.Args().First()
|
||||
if appName == "" {
|
||||
internal.ShowSubcommandHelpAndError(c, errors.New("no app name provided!"))
|
||||
}
|
||||
appName := internal.ValidateAppNameArg(c)
|
||||
|
||||
ctx := context.Background()
|
||||
server := getAppServer(appName)
|
||||
@ -68,10 +64,7 @@ var appVolumeRemoveCommand = &cli.Command{
|
||||
internal.ForceFlag,
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
appName := c.Args().First()
|
||||
if appName == "" {
|
||||
internal.ShowSubcommandHelpAndError(c, errors.New("no app name provided!"))
|
||||
}
|
||||
appName := internal.ValidateAppNameArg(c)
|
||||
server := getAppServer(appName)
|
||||
ctx := context.Background()
|
||||
volumeList, err := client.GetVolumes(ctx, server, appName)
|
||||
|
Reference in New Issue
Block a user