From bd1c0735e0bc3bf7a24ec948372b72a4a9652d03 Mon Sep 17 00:00:00 2001
From: Chris Lu <chris.lu@uber.com>
Date: Sat, 23 Mar 2019 11:54:26 -0700
Subject: [PATCH] weed shell: adjust help text format

---
 weed/shell/command_collection_list.go        | 2 +-
 weed/shell/command_fs_du.go                  | 7 ++++++-
 weed/shell/command_volume_fix_replication.go | 7 ++++++-
 weed/shell/command_volume_list.go            | 6 +++++-
 weed/shell/shell_liner.go                    | 7 +++----
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/weed/shell/command_collection_list.go b/weed/shell/command_collection_list.go
index 0db74ef20..cc16fd291 100644
--- a/weed/shell/command_collection_list.go
+++ b/weed/shell/command_collection_list.go
@@ -19,7 +19,7 @@ func (c *commandCollectionList) Name() string {
 }
 
 func (c *commandCollectionList) Help() string {
-	return "# list all collections"
+	return `list all collections`
 }
 
 func (c *commandCollectionList) Do(args []string, commandEnv *commandEnv, writer io.Writer) (err error) {
diff --git a/weed/shell/command_fs_du.go b/weed/shell/command_fs_du.go
index cdc9d98ef..1206596b0 100644
--- a/weed/shell/command_fs_du.go
+++ b/weed/shell/command_fs_du.go
@@ -25,7 +25,12 @@ func (c *commandFsDu) Name() string {
 }
 
 func (c *commandFsDu) Help() string {
-	return "http://<filer_server>:<port>/dir[/file] # show disk usage"
+	return `show disk usage
+
+	fs.du http://<filer_server>:<port>/dir
+	fs.du http://<filer_server>:<port>/dir/file_name
+	fs.du http://<filer_server>:<port>/dir/file_prefix
+`
 }
 
 func (c *commandFsDu) Do(args []string, commandEnv *commandEnv, writer io.Writer) (err error) {
diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.go
index 6a76ba458..2ec850140 100644
--- a/weed/shell/command_volume_fix_replication.go
+++ b/weed/shell/command_volume_fix_replication.go
@@ -26,7 +26,12 @@ func (c *commandVolumeFixReplication) Name() string {
 func (c *commandVolumeFixReplication) Help() string {
 	return `add replicas to volumes that are missing replicas
 
-	-n do not take action
+	This command file all under-replicated volumes, and find volume servers with free slots.
+	If the free slots satisfy the replication requirement, the volume content is copied over and mounted.
+
+	volume.fix.replication -n # do not take action
+	volume.fix.replication    # actually copying the volume files and mount the volume
+
 `
 }
 
diff --git a/weed/shell/command_volume_list.go b/weed/shell/command_volume_list.go
index 5be5be569..f3f843d58 100644
--- a/weed/shell/command_volume_list.go
+++ b/weed/shell/command_volume_list.go
@@ -19,7 +19,11 @@ func (c *commandVolumeList) Name() string {
 }
 
 func (c *commandVolumeList) Help() string {
-	return "# list all volumes"
+	return `list all volumes
+
+	This command list all volumes as a tree of dataCenter > rack > dataNode > volume.
+
+`
 }
 
 func (c *commandVolumeList) Do(args []string, commandEnv *commandEnv, writer io.Writer) (err error) {
diff --git a/weed/shell/shell_liner.go b/weed/shell/shell_liner.go
index 7d09661dc..403980568 100644
--- a/weed/shell/shell_liner.go
+++ b/weed/shell/shell_liner.go
@@ -92,7 +92,8 @@ func printGenericHelp() {
 		return strings.Compare(commands[i].Name(), commands[j].Name()) < 0
 	})
 	for _, c := range commands {
-		fmt.Printf("\t%s %s \n", c.Name(), c.Help())
+		helpTexts := strings.SplitN(c.Help(), "\n", 2)
+		fmt.Printf("  %-30s\t# %s \n", c.Name(), helpTexts[0])
 	}
 }
 
@@ -111,9 +112,7 @@ func printHelp(cmds []string) {
 
 		for _, c := range commands {
 			if c.Name() == cmd {
-				fmt.Println()
-				fmt.Printf("\t%s %s \n", c.Name(), c.Help())
-				fmt.Println()
+				fmt.Printf("  %s\t# %s\n", c.Name(), c.Help())
 			}
 		}
 	}