1
1
mirror of https://github.com/mcuadros/ascode synced 2024-11-26 06:01:08 +01:00
ascode/main.go
2020-03-27 18:33:10 +01:00

28 lines
743 B
Go

package main
import (
"os"
"github.com/jessevdk/go-flags"
"github.com/mcuadros/ascode/cmd"
)
var version string
var build string
func main() {
parser := flags.NewNamedParser("ascode", flags.Default)
parser.LongDescription = "AsCode - Terraform Alternative Syntax."
parser.AddCommand("run", cmd.RunCmdShortDescription, cmd.RunCmdLongDescription, &cmd.RunCmd{})
parser.AddCommand("repl", cmd.REPLCmdShortDescription, cmd.REPLCmdLongDescription, &cmd.REPLCmd{})
parser.AddCommand("version", cmd.VersionCmdShortDescription, cmd.VersionCmdLongDescription, &cmd.VersionCmd{})
if _, err := parser.Parse(); err != nil {
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type == flags.ErrHelp {
os.Exit(0)
}
os.Exit(1)
}
}