forked from liamjbennett/sous
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sous_context.go
46 lines (35 loc) · 1.19 KB
/
sous_context.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package cli
import (
"flag"
"github.com/opentable/sous/config"
"github.com/opentable/sous/lib"
"github.com/opentable/sous/util/cmdr"
)
// SousContext is the 'sous context' command.
type SousContext struct {
config.DeployFilterFlags
*sous.SourceContext
}
func init() { TopLevelCommands["context"] = &SousContext{} }
const sousContextHelp = `show the current build context
sous context describes Sous's understanding of the state of your
Git respository.
args:
`
// Help provides help for sous context.
func (*SousContext) Help() string { return sousContextHelp }
// RegisterOn adds the DeploymentConfig to the psyringe to configure the
// labeller and registrar
func (sc *SousContext) RegisterOn(psy Addable) {
psy.Add(&sc.DeployFilterFlags)
}
// AddFlags adds flags to the context command.
func (sc *SousContext) AddFlags(fs *flag.FlagSet) {
MustAddFlags(fs, &sc.DeployFilterFlags, SourceFlagsHelp)
//fs.BoolVar(&sb.PolicyFlags.ForceClone, "force-clone", false, "force a shallow clone of the codebase before build")
// above is commented prior to impl.
}
// Execute prints the detected sous context.
func (sc *SousContext) Execute(args []string) cmdr.Result {
return SuccessYAML(sc.SourceContext)
}