diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/rmbook/main.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/rmbook/main.go b/cmd/rmbook/main.go index 8d434a9..c195d85 100644 --- a/cmd/rmbook/main.go +++ b/cmd/rmbook/main.go @@ -13,7 +13,7 @@ import ( "rescribe.xyz/bookpipeline" ) -const usage = `Usage: rmbook bookname +const usage = `Usage: rmbook [-dryrun] bookname Removes a book from cloud storage. ` @@ -33,6 +33,7 @@ type RmPipeliner interface { } func main() { + dryrun := flag.Bool("dryrun", false, "print which files would be deleted but don't delete") flag.Usage = func() { fmt.Fprintf(flag.CommandLine.Output(), usage) flag.PrintDefaults() @@ -68,6 +69,14 @@ func main() { log.Fatalln("No files found for book:", bookname) } + if *dryrun { + fmt.Printf("I would delete these files:\n") + for _, v := range objs { + fmt.Println(v) + } + return + } + fmt.Println("Deleting all files for book") err = conn.DeleteObjects(conn.WIPStorageId(), objs) if err != nil { |