command_line.go 656 B

1234567891011121314151617181920212223242526272829303132333435
  1. package commands
  2. import (
  3. "github.com/codegangsta/cli"
  4. )
  5. type CommandLine interface {
  6. ShowHelp()
  7. ShowVersion()
  8. Application() *cli.App
  9. Args() cli.Args
  10. Bool(name string) bool
  11. Int(name string) int
  12. String(name string) string
  13. StringSlice(name string) []string
  14. GlobalString(name string) string
  15. FlagNames() (names []string)
  16. Generic(name string) interface{}
  17. }
  18. type contextCommandLine struct {
  19. *cli.Context
  20. }
  21. func (c *contextCommandLine) ShowHelp() {
  22. cli.ShowCommandHelp(c.Context, c.Command.Name)
  23. }
  24. func (c *contextCommandLine) ShowVersion() {
  25. cli.ShowVersion(c.Context)
  26. }
  27. func (c *contextCommandLine) Application() *cli.App {
  28. return c.App
  29. }