2019-06-27 00:27:39 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
2019-07-11 23:59:04 +02:00
|
|
|
"github.com/jessevdk/go-flags"
|
2019-08-01 20:43:59 +02:00
|
|
|
"github.com/mcuadros/ascode/cmd"
|
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)
|
2020-03-27 18:33:10 +01:00
|
|
|
parser.LongDescription = "AsCode - Terraform Alternative Syntax."
|
2019-07-11 23:59:04 +02:00
|
|
|
parser.AddCommand("run", cmd.RunCmdShortDescription, cmd.RunCmdLongDescription, &cmd.RunCmd{})
|
|
|
|
parser.AddCommand("repl", cmd.REPLCmdShortDescription, cmd.REPLCmdLongDescription, &cmd.REPLCmd{})
|
2020-03-27 18:33:10 +01:00
|
|
|
parser.AddCommand("version", cmd.VersionCmdShortDescription, cmd.VersionCmdLongDescription, &cmd.VersionCmd{})
|
2019-07-11 23:59:04 +02:00
|
|
|
|
|
|
|
if _, err := parser.Parse(); err != nil {
|
|
|
|
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type == flags.ErrHelp {
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|