From af23e63e3fe97146b93ef1d86f6e47c8f7e2c5c6 Mon Sep 17 00:00:00 2001 From: "yulai.li" Date: Mon, 27 Jun 2022 12:09:16 +0800 Subject: [PATCH] Improve filer command help, add supported filer store list --- weed/command/filer.go | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/weed/command/filer.go b/weed/command/filer.go index c9f9a1956..7e0e92d4a 100644 --- a/weed/command/filer.go +++ b/weed/command/filer.go @@ -6,10 +6,13 @@ import ( "net/http" "os" "runtime" + "sort" + "strings" "time" "google.golang.org/grpc/reflection" + "github.com/chrislusf/seaweedfs/weed/filer" "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" @@ -114,10 +117,8 @@ func init() { filerIamOptions.port = cmdFiler.Flag.Int("iam.port", 8111, "iam server http listen port") } -var cmdFiler = &Command{ - UsageLine: "filer -port=8888 -master=[,]*", - Short: "start a file server that points to a master server, or a list of master servers", - Long: `start a file server which accepts REST operation for any files. +func filerLongDesc() string { + desc := `start a file server which accepts REST operation for any files. //create or overwrite the file, the directories /path/to will be automatically created POST /path/to/file @@ -133,7 +134,22 @@ var cmdFiler = &Command{ The example filer.toml configuration file can be generated by "weed scaffold -config=filer" -`, +Supported Filer Stores: +` + + storeNames := make([]string, len(filer.Stores)) + for i, store := range filer.Stores { + storeNames[i] = "\t" + store.GetName() + } + sort.Strings(storeNames) + storeList := strings.Join(storeNames, "\n") + return desc + storeList +} + +var cmdFiler = &Command{ + UsageLine: "filer -port=8888 -master=[,]*", + Short: "start a file server that points to a master server, or a list of master servers", + Long: filerLongDesc(), } func runFiler(cmd *Command, args []string) bool {