-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmain.go
43 lines (34 loc) · 1.38 KB
/
main.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
package main
import (
"os"
"github.com/jessevdk/go-flags"
"github.com/pivotal-cf/reconfigure-pipeline/actions"
"github.com/pivotal-cf/reconfigure-pipeline/commandrunner"
"github.com/pivotal-cf/reconfigure-pipeline/concourse"
"github.com/pivotal-cf/reconfigure-pipeline/fifo"
"github.com/pivotal-cf/reconfigure-pipeline/lastpass"
)
func main() {
var opts struct {
ConfigPath string `short:"c" long:"config" required:"true" description:"Pipeline configuration file"`
Pipeline string `short:"p" long:"pipeline" required:"true" description:"Pipeline to configure"`
Target string `short:"t" long:"target" required:"true" description:"Concourse target name"`
VariablesPath string `short:"l" long:"load-vars-from" description:"Variable flag that can be used for filling in template values in configuration from a YAML file"`
}
_, err := flags.Parse(&opts)
if err != nil {
os.Exit(2)
}
action := newReconfigurePipeline()
err = action.Run(opts.Target, opts.Pipeline, opts.ConfigPath, opts.VariablesPath)
if err != nil {
os.Exit(1)
}
}
func newReconfigurePipeline() *actions.ReconfigurePipeline {
commandRunner := commandrunner.NewSimpleCommandRunner()
reconfigurer := concourse.NewReconfigurer(commandRunner)
processor := lastpass.NewProcessor(commandRunner)
fifoWriter := fifo.NewWriter()
return actions.NewReconfigurePipeline(reconfigurer, processor, fifoWriter)
}