Transfer command refactoring

Make transfer command processing even more modular
This commit is contained in:
Philipp Wolfer 2023-12-05 08:10:38 +01:00
parent 7c85ba05ab
commit a9e07915ce
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
7 changed files with 236 additions and 179 deletions

View file

@ -25,6 +25,7 @@ import (
"github.com/spf13/viper"
"go.uploadedlobster.com/scotty/internal/auth"
"go.uploadedlobster.com/scotty/internal/backends"
"go.uploadedlobster.com/scotty/internal/cli"
"go.uploadedlobster.com/scotty/internal/models"
"go.uploadedlobster.com/scotty/internal/storage"
"golang.org/x/oauth2"
@ -36,7 +37,7 @@ var authCmd = &cobra.Command{
Short: "Authenticate with a backend",
Long: `For backends requiring authentication this command can be used to authenticate.`,
Run: func(cmd *cobra.Command, args []string) {
serviceName, serviceConfig := getConfigFromFlag(cmd, "service")
serviceName, serviceConfig := cli.GetConfigFromFlag(cmd, "service")
backend, err := backends.ResolveBackend[models.OAuth2Authenticator](serviceConfig)
cobra.CheckErr(err)