service auth, edit and delete now all support --service flag

If a service name is given, this will be used. If not the user is
prompted to select one.
This commit is contained in:
Philipp Wolfer 2023-12-09 22:59:33 +01:00
parent c21715d36b
commit 9449a29fb1
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
9 changed files with 29 additions and 51 deletions

View file

@ -20,11 +20,9 @@ import (
"go.uploadedlobster.com/scotty/internal/config"
)
func GetServiceConfigFromFlag(cmd *cobra.Command, flagName string) *config.ServiceConfig {
func GetServiceConfigFromFlag(cmd *cobra.Command, flagName string) (config.ServiceConfig, error) {
name := cmd.Flag(flagName).Value.String()
config, err := config.GetService(name)
cobra.CheckErr(err)
return config
return config.GetService(name)
}
func getInt64FromFlag(cmd *cobra.Command, flagName string) (result int64) {