diff options
| author | Petter Rasmussen | 2015-05-23 14:32:19 +0200 |
|---|---|---|
| committer | Petter Rasmussen | 2015-05-23 14:32:19 +0200 |
| commit | 3696f1bbc323dd58174a15f8522a73258f6d7015 (patch) | |
| tree | 0dc71b7e68e1b60c1556d10d261a05ed820abc8d | |
| parent | dd1adb7b4abeeea1ba92bd23851f46382a618d60 (diff) | |
| download | gdrive-3696f1bbc323dd58174a15f8522a73258f6d7015.tar.bz2 | |
Add flag --include-docs to include google docs in listing
| -rw-r--r-- | cli/cli.go | 5 | ||||
| -rw-r--r-- | drive.go | 3 |
2 files changed, 4 insertions, 4 deletions
@@ -13,7 +13,7 @@ import ( "strings" ) -func List(d *gdrive.Drive, query, titleFilter string, maxResults int, sharedStatus bool, noHeader bool) error { +func List(d *gdrive.Drive, query, titleFilter string, maxResults int, sharedStatus bool, noHeader bool, includeDocs bool) error { caller := d.Files.List() if maxResults > 0 { @@ -37,8 +37,7 @@ func List(d *gdrive.Drive, query, titleFilter string, maxResults int, sharedStat items := make([]map[string]string, 0, 0) for _, f := range list.Items { - // Skip files that dont have a download url (they are not stored on google drive) - if f.DownloadUrl == "" { + if f.DownloadUrl == "" && !includeDocs { if f.MimeType != "application/vnd.google-apps.folder" { continue } @@ -24,6 +24,7 @@ type Options struct { List struct { MaxResults int `goptions:"-m, --max, description='Max results'"` + IncludeDocs bool `goptions:"--include-docs, mutexgroup='query', description='Include google docs in listing'"` TitleFilter string `goptions:"-t, --title, mutexgroup='query', description='Title filter'"` Query string `goptions:"-q, --query, mutexgroup='query', description='Query (see https://developers.google.com/drive/search-parameters)'"` SharedStatus bool `goptions:"-s, --shared, description='Show shared status (Note: this will generate 1 http req per file)'"` @@ -97,7 +98,7 @@ func main() { switch opts.Verbs { case "list": args := opts.List - err = cli.List(drive, args.Query, args.TitleFilter, args.MaxResults, args.SharedStatus, args.NoHeader) + err = cli.List(drive, args.Query, args.TitleFilter, args.MaxResults, args.SharedStatus, args.NoHeader, args.IncludeDocs) case "info": err = cli.Info(drive, opts.Info.FileId) |
