Browse Source

weed shell: adjust help text format

pull/902/head
Chris Lu 6 years ago
parent
commit
bd1c0735e0
  1. 2
      weed/shell/command_collection_list.go
  2. 7
      weed/shell/command_fs_du.go
  3. 7
      weed/shell/command_volume_fix_replication.go
  4. 6
      weed/shell/command_volume_list.go
  5. 7
      weed/shell/shell_liner.go

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

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

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

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

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

Loading…
Cancel
Save