aboutsummaryrefslogtreecommitdiffstats
path: root/handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'handlers.go')
-rw-r--r--handlers.go22
1 files changed, 14 insertions, 8 deletions
diff --git a/handlers.go b/handlers.go
index b09159f..64e4fcd 100644
--- a/handlers.go
+++ b/handlers.go
@@ -15,9 +15,8 @@ const TokenFilename = "token_v2.json"
func listHandler(ctx cli.Context) {
args := ctx.Args()
- gdrive := newDrive(args)
- gdrive.List(drive.ListFilesArgs{
+ newDrive(args).List(drive.ListFilesArgs{
MaxFiles: args.Int64("maxFiles"),
NameWidth: args.Int64("nameWidth"),
Query: args.String("query"),
@@ -28,9 +27,8 @@ func listHandler(ctx cli.Context) {
func downloadHandler(ctx cli.Context) {
args := ctx.Args()
- gdrive := newDrive(args)
- gdrive.Download(drive.DownloadFileArgs{
+ newDrive(args).Download(drive.DownloadFileArgs{
Id: args.String("id"),
Force: args.Bool("force"),
Stdout: args.Bool("stdout"),
@@ -40,9 +38,8 @@ func downloadHandler(ctx cli.Context) {
func uploadHandler(ctx cli.Context) {
args := ctx.Args()
- gdrive := newDrive(args)
- gdrive.Upload(drive.UploadFileArgs{
+ newDrive(args).Upload(drive.UploadFileArgs{
Path: args.String("path"),
Name: args.String("name"),
Parent: args.String("parent"),
@@ -55,14 +52,23 @@ func uploadHandler(ctx cli.Context) {
func infoHandler(ctx cli.Context) {
args := ctx.Args()
- gdrive := newDrive(args)
- gdrive.Info(drive.FileInfoArgs{
+ newDrive(args).Info(drive.FileInfoArgs{
Id: args.String("id"),
SizeInBytes: args.Bool("sizeInBytes"),
})
}
+func mkdirHandler(ctx cli.Context) {
+ args := ctx.Args()
+
+ newDrive(args).Mkdir(drive.MkdirArgs{
+ Name: args.String("name"),
+ Parent: args.String("parent"),
+ Share: args.Bool("share"),
+ })
+}
+
func deleteHandler(ctx cli.Context) {
fmt.Println("Deleting...")
}