You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
536 B

package cli
import "fmt"
import "os"
import "text/tabwriter"
var HelpCommand = Command{
Name: "help",
ShortName: "h",
Usage: "View help topics",
Action: ShowHelp,
}
var ShowHelp = func(name string) {
w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0)
fmt.Printf("Usage: %v [global-options] COMMAND [command-options]\n\n", Name)
if Commands != nil {
fmt.Printf("The most commonly used %v commands are:\n", Name)
for _, c := range Commands {
fmt.Fprintln(w, " "+c.Name+"\t"+c.Usage)
}
w.Flush()
}
}