feat: add app name verification to all golang plugins

Moving verification of input to the earliest place is the best way to decrease the need to validate this further downstream.

Additionally, some of the existing checks were.... lacking :)
This commit is contained in:
Jose Diaz-Gonzalez
2020-12-25 00:00:26 -05:00
parent 382dc01b33
commit ffa303092f
8 changed files with 41 additions and 94 deletions

View File

@@ -79,10 +79,6 @@ func CommandDestroy(appName string, force bool) error {
// CommandExists checks if an app exists
func CommandExists(appName string) error {
if appName == "" {
return errors.New("Please specify an app to run the command on")
}
return appExists(appName)
}
@@ -104,10 +100,6 @@ func CommandList() error {
// CommandLock locks an app for deployment
func CommandLock(appName string) error {
if appName == "" {
return errors.New("Please specify an app to run the command on")
}
if err := common.VerifyAppName(appName); err != nil {
return err
}
@@ -123,10 +115,6 @@ func CommandLock(appName string) error {
// CommandLocked checks if an app is locked for deployment
func CommandLocked(appName string) error {
if appName == "" {
return errors.New("Please specify an app to run the command on")
}
if err := common.VerifyAppName(appName); err != nil {
return err
}
@@ -206,10 +194,6 @@ func CommandReport(appName string, infoFlag string) error {
// CommandUnlock unlocks an app for deployment
func CommandUnlock(appName string) error {
if appName == "" {
return errors.New("Please specify an app to run the command on")
}
if err := common.VerifyAppName(appName); err != nil {
return err
}