Skip to content

Commit 18e7790

Browse files
author
Emmanuel Odeke
committed
list: Shorten "My Drive" -> ""
1 parent ec598dd commit 18e7790

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/list.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import (
2525

2626
var BytesPerKB = float64(1024)
2727

28+
const RemoteDriveRootPath = "My Drive"
29+
2830
const (
2931
InTrash = 1 << iota
3032
Folder
@@ -104,7 +106,11 @@ func (g *Commands) List() (err error) {
104106
}
105107

106108
for _, r := range remotes {
107-
if !g.breadthFirst(r.Id, "", r.Name, g.opts.Depth, g.opts.TypeMask, false) {
109+
headPath := r.Name
110+
if headPath == RemoteDriveRootPath {
111+
headPath = ""
112+
}
113+
if !g.breadthFirst(r.Id, "", headPath, g.opts.Depth, g.opts.TypeMask, false) {
108114
break
109115
}
110116
}
@@ -130,10 +136,10 @@ func (g *Commands) List() (err error) {
130136
}
131137

132138
func (f *File) pretty(opt attribute) {
133-
fmtdPath := fmt.Sprintf("%s/%s", opt.parent, f.Name)
139+
fmtdPath := fmt.Sprintf("%s/%s", opt.parent, urlToPath(f.Name, false))
140+
134141
if opt.minimal {
135142
fmt.Println(fmtdPath)
136-
137143
if owners(opt.mask) && len(f.OwnerNames) >= 1 {
138144
fmt.Printf(" %s ", strings.Join(f.OwnerNames, " & "))
139145
}

0 commit comments

Comments
 (0)