2021-06-25 09:14:27 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"git.ewintr.nl/gte/cmd/cli/command"
|
|
|
|
"git.ewintr.nl/gte/internal/configuration"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2021-07-09 07:45:09 +02:00
|
|
|
configPath := "./gte.conf"
|
2021-06-25 09:14:27 +02:00
|
|
|
if os.Getenv("GTE_CONFIG") != "" {
|
|
|
|
configPath = os.Getenv("GTE_CONFIG")
|
|
|
|
}
|
|
|
|
configFile, err := os.Open(configPath)
|
|
|
|
if err != nil {
|
2021-07-09 07:45:09 +02:00
|
|
|
fmt.Println(err, "could not open config file")
|
2021-06-25 09:14:27 +02:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
config := configuration.New(configFile)
|
|
|
|
|
|
|
|
cmd, err := command.Parse(os.Args[1:], config)
|
|
|
|
if err != nil {
|
2021-07-09 07:45:09 +02:00
|
|
|
fmt.Println(err, "could not initialize command")
|
2021-06-25 09:14:27 +02:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
2021-09-04 19:47:36 +02:00
|
|
|
fmt.Printf("%s", cmd.Do())
|
2021-06-25 09:14:27 +02:00
|
|
|
}
|