-
-
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/upload): Add
slu google-drive upload
cli
- Loading branch information
1 parent
94ca5b2
commit 2ecba35
Showing
3 changed files
with
69 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,16 @@ | ||
package google_drive | ||
|
||
import ( | ||
"github.com/sikalabs/slu/cmd/root" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "google-drive", | ||
Short: "Google Drive Utils", | ||
Aliases: []string{"gdrive", "gdr"}, | ||
} | ||
|
||
func init() { | ||
root.RootCmd.AddCommand(Cmd) | ||
} |
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,51 @@ | ||
package upload | ||
|
||
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 FlagAccessToken string | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "upload", | ||
Short: "Upload file to Goole Drive", | ||
Aliases: []string{"u"}, | ||
Args: cobra.ExactArgs(1), | ||
Run: func(c *cobra.Command, args []string) { | ||
google_drive_utils.Upload( | ||
FlagClientId, | ||
FlagClientSecret, | ||
FlagAccessToken, | ||
args[0], | ||
) | ||
}, | ||
} | ||
|
||
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") | ||
Cmd.Flags().StringVar( | ||
&FlagAccessToken, | ||
"access-token", | ||
"", | ||
"Google Drive Access Token", | ||
) | ||
} |