diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-12-14 01:27:31 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-12-14 01:27:31 -0800 |
| commit | 97dcae827b4062c147957128e77ae4c673e91e45 (patch) | |
| tree | a9e00ad2f18c0bec40152fb25e7ac4230e1d4a7e | |
| parent | 2e8dba571b9182ea5f5cdc74bffabce33db514a7 (diff) | |
| parent | 3d47c38262c6e3194e5a9b73c66a00ff3320208a (diff) | |
| download | seaweedfs-97dcae827b4062c147957128e77ae4c673e91e45.tar.xz seaweedfs-97dcae827b4062c147957128e77ae4c673e91e45.zip | |
Merge branch 'master' into support_ssd_volume
| -rw-r--r-- | weed/shell/command_collection_delete.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/weed/shell/command_collection_delete.go b/weed/shell/command_collection_delete.go index 5777d5780..e43f2a093 100644 --- a/weed/shell/command_collection_delete.go +++ b/weed/shell/command_collection_delete.go @@ -34,14 +34,22 @@ func (c *commandCollectionDelete) Do(args []string, commandEnv *CommandEnv, writ } colDeleteCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError) - collectionName := colDeleteCommand.String("collection", "", "collection to delete") + collectionName := colDeleteCommand.String("collection", "", "collection to delete. Use '_default_' for the empty-named collection.") applyBalancing := colDeleteCommand.Bool("force", false, "apply the collection") if err = colDeleteCommand.Parse(args); err != nil { return nil } + if *collectionName == "" { + return fmt.Errorf("empty collection name is not allowed") + } + + if *collectionName == "_default_" { + *collectionName = "" + } + if !*applyBalancing { - fmt.Fprintf(writer, "collection %s will be deleted. Use -force to apply the change.\n", *collectionName) + fmt.Fprintf(writer, "collection '%s' will be deleted. Use -force to apply the change.\n", *collectionName) return nil } |
