2019-06-27 00:27:39 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2019-07-05 03:43:25 +02:00
|
|
|
"fmt"
|
2019-06-27 00:27:39 +02:00
|
|
|
"os"
|
|
|
|
|
2019-07-11 23:59:04 +02:00
|
|
|
"github.com/ascode-dev/ascode/cmd"
|
|
|
|
"github.com/jessevdk/go-flags"
|
2019-06-27 00:27:39 +02:00
|
|
|
)
|
|
|
|
|
2019-07-11 23:59:04 +02:00
|
|
|
var version string
|
|
|
|
var build string
|
2019-07-05 03:43:25 +02:00
|
|
|
|
2019-07-11 23:59:04 +02:00
|
|
|
func main() {
|
|
|
|
parser := flags.NewNamedParser("ascode", flags.Default)
|
|
|
|
parser.LongDescription = "AsCode - The real infrastructure as code."
|
|
|
|
parser.AddCommand("run", cmd.RunCmdShortDescription, cmd.RunCmdLongDescription, &cmd.RunCmd{})
|
|
|
|
parser.AddCommand("repl", cmd.REPLCmdShortDescription, cmd.REPLCmdLongDescription, &cmd.REPLCmd{})
|
|
|
|
|
|
|
|
if _, err := parser.Parse(); err != nil {
|
|
|
|
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type == flags.ErrHelp {
|
|
|
|
fmt.Printf("Build information\n commit: %s\n date:%s\n", version, build)
|
|
|
|
os.Exit(0)
|
2019-07-05 03:43:25 +02:00
|
|
|
}
|
|
|
|
|
2019-07-11 23:59:04 +02:00
|
|
|
os.Exit(1)
|
2019-06-27 00:27:39 +02:00
|
|
|
}
|
|
|
|
}
|