diff options
| -rw-r--r-- | drive/import.go | 8 | ||||
| -rw-r--r-- | drive/share.go | 2 | ||||
| -rw-r--r-- | drive/sync_upload.go | 2 | ||||
| -rw-r--r-- | gdrive.go | 10 | ||||
| -rw-r--r-- | handlers_drive.go | 2 | 
5 files changed, 21 insertions, 3 deletions
| diff --git a/drive/import.go b/drive/import.go index 2ee5f1e..0162aa3 100644 --- a/drive/import.go +++ b/drive/import.go @@ -11,15 +11,19 @@ import (  type ImportArgs struct {  	Out      io.Writer +	Mime     string  	Progress io.Writer  	Path     string  	Parents  []string  }  func (self *Drive) Import(args ImportArgs) error { -	fromMime := getMimeType(args.Path) +	fromMime := args.Mime  	if fromMime == "" { -		return fmt.Errorf("Could not determine mime type of file") +		fromMime = getMimeType(args.Path) +	} +	if fromMime == "" { +		return fmt.Errorf("Could not determine mime type of file, use --mime")  	}  	about, err := self.service.About.Get().Fields("importFormats").Do() diff --git a/drive/share.go b/drive/share.go index 69b9c7d..e942c17 100644 --- a/drive/share.go +++ b/drive/share.go @@ -13,6 +13,7 @@ type ShareArgs struct {  	Role         string  	Type         string  	Email        string +	Domain       string  	Discoverable bool  } @@ -22,6 +23,7 @@ func (self *Drive) Share(args ShareArgs) error {  		Role:               args.Role,  		Type:               args.Type,  		EmailAddress:       args.Email, +		Domain:             args.Domain,  	}  	_, err := self.service.Permissions.Create(args.FileId, permission).Do() diff --git a/drive/sync_upload.go b/drive/sync_upload.go index 261497d..f1e43a4 100644 --- a/drive/sync_upload.go +++ b/drive/sync_upload.go @@ -120,7 +120,7 @@ func (self *Drive) prepareSyncRoot(args UploadSyncArgs) (*drive.File, error) {  	// Ensure that the directory is empty  	if !isEmpty { -		return nil, fmt.Errorf("Root directoy is not empty, the initial sync requires an empty directory") +		return nil, fmt.Errorf("Root directory is not empty, the initial sync requires an empty directory")  	}  	// Update directory with syncRoot property @@ -393,6 +393,11 @@ func main() {  						Patterns:    []string{"--email"},  						Description: "The email address of the user or group to share the file with. Requires 'user' or 'group' as type",  					}, +					cli.StringFlag{ +						Name:        "domain", +						Patterns:    []string{"--domain"}, +						Description: "The name of Google Apps domain. Requires 'domain' as type", +					},					  					cli.BoolFlag{  						Name:        "discoverable",  						Patterns:    []string{"--discoverable"}, @@ -732,6 +737,11 @@ func main() {  						Description: "Hide progress",  						OmitValue:   true,  					}, +					cli.StringFlag{ +						Name:        "mime", +						Patterns:    []string{"--mime"}, +						Description: "Mime type of imported file", +					},  				),  			},  		}, diff --git a/handlers_drive.go b/handlers_drive.go index 415224d..5b651ba 100644 --- a/handlers_drive.go +++ b/handlers_drive.go @@ -193,6 +193,7 @@ func infoHandler(ctx cli.Context) {  func importHandler(ctx cli.Context) {  	args := ctx.Args()  	err := newDrive(args).Import(drive.ImportArgs{ +		Mime:     args.String("mime"),  		Out:      os.Stdout,  		Path:     args.String("path"),  		Parents:  args.StringSlice("parent"), @@ -243,6 +244,7 @@ func shareHandler(ctx cli.Context) {  		Role:         args.String("role"),  		Type:         args.String("type"),  		Email:        args.String("email"), +		Domain:       args.String("domain"),  		Discoverable: args.Bool("discoverable"),  	})  	checkErr(err) | 
