1
1
mirror of https://github.com/mcuadros/ascode synced 2024-11-23 01:11:59 +01:00
ascode/main.go

28 lines
743 B
Go
Raw Normal View History

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)
2020-03-27 18:33:10 +01:00
parser.LongDescription = "AsCode - Terraform Alternative Syntax."
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{})
if _, err := parser.Parse(); err != nil {
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type == flags.ErrHelp {
os.Exit(0)
}
os.Exit(1)
}
}