Skip to content

Commit

Permalink
Support directory delete option (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mir Shahriar authored and tamalsaha committed Aug 21, 2017
1 parent d5a9197 commit fc5a4c5
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cmds/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/appscode/go-term"
otx "github.com/appscode/osm/context"
"github.com/graymeta/stow"
"github.com/spf13/cobra"
)

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

err = c.RemoveItem(req.itemID)
term.ExitOnError(err)
term.Successln("Successfully removed item " + req.itemID)
cursor := stow.CursorStart
for {
items, next, err := c.Items(req.itemID, cursor, 50)
term.ExitOnError(err)
for _, item := range items {
err = c.RemoveItem(item.ID())
term.ExitOnError(err)
term.Successln("Successfully removed item " + item.ID())
}
cursor = next
if stow.IsCursorEnd(cursor) {
break
}
}
}

0 comments on commit fc5a4c5

Please sign in to comment.