aboutsummaryrefslogtreecommitdiff
path: root/go/cmd/command.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2013-02-10 04:05:28 -0800
committerChris Lu <chris.lu@gmail.com>2013-02-10 04:05:28 -0800
commitd4e5a22e5312ce2d0a2a8e25d45d27971b147252 (patch)
treee5d20f4b0214180a98706850c9fcaaca10c80329 /go/cmd/command.go
parent37a1a70cc3c960eb288257646d4888eb75473fc6 (diff)
downloadseaweedfs-d4e5a22e5312ce2d0a2a8e25d45d27971b147252.tar.xz
seaweedfs-d4e5a22e5312ce2d0a2a8e25d45d27971b147252.zip
rename from cmd to weed for easier "go build"
Diffstat (limited to 'go/cmd/command.go')
-rw-r--r--go/cmd/command.go54
1 files changed, 0 insertions, 54 deletions
diff --git a/go/cmd/command.go b/go/cmd/command.go
deleted file mode 100644
index c8d86ca66..000000000
--- a/go/cmd/command.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package main
-
-import (
- "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
-
- // 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
-
- // 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
-
- IsDebug *bool
-}
-
-// 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
-}
-
-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)
-}
-
-// 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
-}