Skip to content

Commit

Permalink
feat(cmd/google_drive/get_token): Add get-token to login using device…
Browse files Browse the repository at this point in the history
… code
  • Loading branch information
ondrejsika committed Oct 23, 2023
1 parent 4c8530e commit a4d18d8
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ import (
_ "github.com/sikalabs/slu/cmd/golang"
_ "github.com/sikalabs/slu/cmd/golang/build_all_platforms"
_ "github.com/sikalabs/slu/cmd/google_drive"
_ "github.com/sikalabs/slu/cmd/google_drive/get_token"
_ "github.com/sikalabs/slu/cmd/google_drive/upload"
_ "github.com/sikalabs/slu/cmd/helm"
_ "github.com/sikalabs/slu/cmd/helm/version_bump"
Expand Down
42 changes: 42 additions & 0 deletions cmd/google_drive/get_token/get_token.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package get_token

import (
parent_cmd "github.com/sikalabs/slu/cmd/google_drive"
"github.com/sikalabs/slu/utils/google_drive_utils"

"github.com/spf13/cobra"
)

var FlagClientId string
var FlagClientSecret string

var Cmd = &cobra.Command{
Use: "get-token",
Short: "Get Access Token to Goole Drive API",
Aliases: []string{"u"},
Args: cobra.NoArgs,
Run: func(c *cobra.Command, args []string) {
google_drive_utils.GetToken(
FlagClientId,
FlagClientSecret,
)
},
}

func init() {
parent_cmd.Cmd.AddCommand(Cmd)
Cmd.Flags().StringVar(
&FlagClientId,
"client-id",
"",
"Google Drive Client ID",
)
Cmd.MarkFlagRequired("client-id")
Cmd.Flags().StringVar(
&FlagClientSecret,
"client-secret",
"",
"Google Drive Client Secret",
)
Cmd.MarkFlagRequired("client-secret")
}

0 comments on commit a4d18d8

Please sign in to comment.