aboutsummaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorPetter Rasmussen2015-05-23 22:42:28 +0200
committerPetter Rasmussen2015-05-23 22:42:28 +0200
commit1cba1144f2860da6bf24552fdad84d4eab6e931a (patch)
treeb539d346bd44c88a2785dc2471f208f34cfbcd31 /cli
parent1f613ca24a9ec4f7f64106df65f0d5fabe88da85 (diff)
downloadgdrive-1cba1144f2860da6bf24552fdad84d4eab6e931a.tar.bz2
Add --bytes flag to list and info
Diffstat (limited to 'cli')
-rw-r--r--cli/cli.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/cli/cli.go b/cli/cli.go
index 49ba1e7..764a42a 100644
--- a/cli/cli.go
+++ b/cli/cli.go
@@ -13,7 +13,7 @@ import (
"strings"
)
-func List(d *gdrive.Drive, query, titleFilter string, maxResults int, sharedStatus bool, noHeader bool, includeDocs bool) error {
+func List(d *gdrive.Drive, query, titleFilter string, maxResults int, sharedStatus, noHeader, includeDocs, sizeInBytes bool) error {
caller := d.Files.List()
if maxResults > 0 {
@@ -49,7 +49,7 @@ func List(d *gdrive.Drive, query, titleFilter string, maxResults int, sharedStat
items = append(items, map[string]string{
"Id": f.Id,
"Title": util.TruncateString(f.Title, 40),
- "Size": util.FileSizeFormat(f.FileSize, false),
+ "Size": util.FileSizeFormat(f.FileSize, sizeInBytes),
"Created": util.ISODateToLocal(f.CreatedDate),
})
}
@@ -96,12 +96,12 @@ func addSharedStatus(d *gdrive.Drive, items []map[string]string) {
}
}
-func Info(d *gdrive.Drive, fileId string) error {
+func Info(d *gdrive.Drive, fileId string, sizeInBytes bool) error {
info, err := d.Files.Get(fileId).Do()
if err != nil {
return fmt.Errorf("An error occurred: %v\n", err)
}
- printInfo(d, info, false)
+ printInfo(d, info, sizeInBytes)
return nil
}