diff options
| author | Chris Lu <chris.lu@gmail.com> | 2013-01-17 00:15:05 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2013-01-17 00:15:05 -0800 |
| commit | bf9c4ed033db62e45ae756a5dd3fd100a3ae8903 (patch) | |
| tree | 584ddca2fc6c987daaa34cacf6512ae077c7e41f /weed-fs/src/cmd/weed/command.go | |
| parent | d1494ea786eae5816cb06e83f09142a234ccfb4f (diff) | |
| download | seaweedfs-bf9c4ed033db62e45ae756a5dd3fd100a3ae8903.tar.xz seaweedfs-bf9c4ed033db62e45ae756a5dd3fd100a3ae8903.zip | |
Revert "add cmd/dump - a dumper"
This reverts commit 5d2a1e8d4845e7a7f1dccd962bb0ee6a5f9d6081.
Diffstat (limited to 'weed-fs/src/cmd/weed/command.go')
| -rw-r--r-- | weed-fs/src/cmd/weed/command.go | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/weed-fs/src/cmd/weed/command.go b/weed-fs/src/cmd/weed/command.go index 4d68ff151..8c725cafb 100644 --- a/weed-fs/src/cmd/weed/command.go +++ b/weed-fs/src/cmd/weed/command.go @@ -1,52 +1,53 @@ package main import ( - "flag" - "fmt" - "os" - "strings" + "flag" + "fmt" + "os" + "strings" ) type Command struct { - // Run runs the command. - // The args are the arguments after the command name. - Run func(cmd *Command, args []string) bool + // Run runs the command. + // The args are the arguments after the command name. + Run func(cmd *Command, args []string) bool - // UsageLine is the one-line usage message. - // The first word in the line is taken to be the command name. - UsageLine string + // UsageLine is the one-line usage message. + // The first word in the line is taken to be the command name. + UsageLine string - // Short is the short description shown in the 'go help' output. - Short string + // Short is the short description shown in the 'go help' output. + Short string - // Long is the long message shown in the 'go help <this-command>' output. - Long string + // Long is the long message shown in the 'go help <this-command>' output. + Long string + + // Flag is a set of flags specific to this command. + Flag flag.FlagSet - // Flag is a set of flags specific to this command. - Flag flag.FlagSet } // Name returns the command's name: the first word in the usage line. func (c *Command) Name() string { - name := c.UsageLine - i := strings.Index(name, " ") - if i >= 0 { - name = name[:i] - } - return name + name := c.UsageLine + i := strings.Index(name, " ") + if i >= 0 { + name = name[:i] + } + return name } func (c *Command) Usage() { - fmt.Fprintf(os.Stderr, "Example: weed %s\n", c.UsageLine) - fmt.Fprintf(os.Stderr, "Default Usage:\n") - c.Flag.PrintDefaults() - fmt.Fprintf(os.Stderr, "Description:\n") - fmt.Fprintf(os.Stderr, " %s\n", strings.TrimSpace(c.Long)) - os.Exit(2) + fmt.Fprintf(os.Stderr, "Example: weed %s\n", c.UsageLine) + fmt.Fprintf(os.Stderr, "Default Usage:\n") + c.Flag.PrintDefaults() + fmt.Fprintf(os.Stderr, "Description:\n") + fmt.Fprintf(os.Stderr, " %s\n", strings.TrimSpace(c.Long)) + os.Exit(2) } // Runnable reports whether the command can be run; otherwise // it is a documentation pseudo-command such as importpath. func (c *Command) Runnable() bool { - return c.Run != nil + return c.Run != nil } |
