migrate fix command

git-svn-id: https://weed-fs.googlecode.com/svn/trunk@63 282b0af5-e82d-9cf1-ede4-77906d7719d0
This commit is contained in:
chris.lu@gmail.com
2012-08-07 01:20:26 +00:00
parent 51860424a6
commit 3f1136c194
4 changed files with 86 additions and 48 deletions

View File

@@ -10,7 +10,7 @@ import (
type Command struct {
// Run runs the command.
// The args are the arguments after the command name.
Run func(cmd *Command, args []string)
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.
@@ -25,9 +25,6 @@ type Command struct {
// Flag is a set of flags specific to this command.
Flag flag.FlagSet
// CustomFlags indicates that the command will do its own
// flag parsing.
CustomFlags bool
}
// Name returns the command's name: the first word in the usage line.
@@ -41,8 +38,8 @@ func (c *Command) Name() string {
}
func (c *Command) Usage() {
fmt.Fprintf(os.Stderr, "usage: %s\n\n", c.UsageLine)
fmt.Fprintf(os.Stderr, "%s\n", strings.TrimSpace(c.Long))
fmt.Fprintf(os.Stderr, "Usage: %s\n", c.UsageLine)
fmt.Fprintf(os.Stderr, " %s\n", strings.TrimSpace(c.Long))
os.Exit(2)
}