2016-02-15 14:09:34 +01:00
|
|
|
package commands
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/codegangsta/cli"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type CommandLine interface {
|
|
|
|
|
ShowHelp()
|
|
|
|
|
ShowVersion()
|
|
|
|
|
Application() *cli.App
|
|
|
|
|
Args() cli.Args
|
|
|
|
|
Bool(name string) bool
|
|
|
|
|
Int(name string) int
|
|
|
|
|
String(name string) string
|
|
|
|
|
StringSlice(name string) []string
|
|
|
|
|
GlobalString(name string) string
|
|
|
|
|
FlagNames() (names []string)
|
|
|
|
|
Generic(name string) interface{}
|
2016-06-24 20:14:58 +02:00
|
|
|
|
|
|
|
|
PluginDirectory() string
|
|
|
|
|
RepoDirectory() string
|
2017-09-15 20:34:08 +02:00
|
|
|
PluginURL() string
|
2016-02-15 14:09:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type contextCommandLine struct {
|
|
|
|
|
*cli.Context
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *contextCommandLine) ShowHelp() {
|
|
|
|
|
cli.ShowCommandHelp(c.Context, c.Command.Name)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *contextCommandLine) ShowVersion() {
|
|
|
|
|
cli.ShowVersion(c.Context)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *contextCommandLine) Application() *cli.App {
|
|
|
|
|
return c.App
|
|
|
|
|
}
|
2016-06-24 20:14:58 +02:00
|
|
|
|
|
|
|
|
func (c *contextCommandLine) PluginDirectory() string {
|
|
|
|
|
return c.GlobalString("pluginsDir")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *contextCommandLine) RepoDirectory() string {
|
|
|
|
|
return c.GlobalString("repo")
|
|
|
|
|
}
|
2017-09-15 20:34:08 +02:00
|
|
|
|
|
|
|
|
func (c *contextCommandLine) PluginURL() string {
|
|
|
|
|
return c.GlobalString("pluginUrl")
|
|
|
|
|
}
|