-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cmd/google_drive/get_token): Add get-token to login using device…
… code
- Loading branch information
1 parent
4c8530e
commit a4d18d8
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} |