weed shell: adjust help text format

This commit is contained in:
Chris Lu 2019-03-23 11:54:26 -07:00
parent 6b70b36105
commit bd1c0735e0
5 changed files with 21 additions and 8 deletions

View file

@ -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) {

View file

@ -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) {

View file

@ -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
`
}

View file

@ -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) {

View file

@ -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())
}
}
}