forked from Scalingo/scalingo-addon-api-tester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
44 lines (40 loc) · 1021 Bytes
/
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
44
package main
import (
"fmt"
"log"
"os"
"github.com/codegangsta/cli"
)
var (
manifestPathFlag = cli.StringFlag{Name: "manifest,m", Usage: "Path to the addon manifest", Value: "manifest.json", EnvVar: "MANIFEST_PATH"}
manifest *Manifest
)
func main() {
app := cli.NewApp()
app.Name = "scalingo-addon-api-tester"
app.Usage = "Test your addon HTTP service"
app.Flags = []cli.Flag{manifestPathFlag}
app.Version = "0.0.1"
app.Author = "Leo Unbekandt"
app.Email = "[email protected]"
app.Before = func(c *cli.Context) error {
var err error
manifest, err = readManifest(c.String("manifest"))
if err != nil {
log.Fatalln("Failed to read addon manifest:", err)
}
err = manifest.Check()
if err != nil {
fmt.Printf("Errors in the manifest:\n%v\n", err)
os.Exit(1)
}
return nil
}
app.Commands = []cli.Command{
provisionCommand, deprovisionCommand, updateCommand, listCommand, purgeCommand,
}
err := app.Run(os.Args)
if err != nil {
log.Fatalln("An error occured:", err)
}
}