Skip to content

Commit fc5a4c5

Browse files
Mir Shahriartamalsaha
authored andcommitted
Support directory delete option (#14)
1 parent d5a9197 commit fc5a4c5

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

cmds/rm.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/appscode/go-term"
77
otx "github.com/appscode/osm/context"
8+
"github.com/graymeta/stow"
89
"github.com/spf13/cobra"
910
)
1011

@@ -51,7 +52,18 @@ func removeItem(req *itemRemoveRequest, configPath string) {
5152
c, err := loc.Container(req.container)
5253
term.ExitOnError(err)
5354

54-
err = c.RemoveItem(req.itemID)
55-
term.ExitOnError(err)
56-
term.Successln("Successfully removed item " + req.itemID)
55+
cursor := stow.CursorStart
56+
for {
57+
items, next, err := c.Items(req.itemID, cursor, 50)
58+
term.ExitOnError(err)
59+
for _, item := range items {
60+
err = c.RemoveItem(item.ID())
61+
term.ExitOnError(err)
62+
term.Successln("Successfully removed item " + item.ID())
63+
}
64+
cursor = next
65+
if stow.IsCursorEnd(cursor) {
66+
break
67+
}
68+
}
5769
}

0 commit comments

Comments
 (0)