Files
gas-stack/cmd/main.go
~wispem-wantex 171da4139b
Some checks failed
CI / build-docker (push) Successful in 4s
CI / build-docker-bootstrap (push) Has been skipped
CI / release-test (push) Failing after 13s
cmd: add a 'version' subcommand and flag to show the version
2026-09-21 17:28:59 -07:00

36 lines
726 B
Go

package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
"git.offline-twitter.com/offline-labs/gas-stack/pkg/version"
)
const (
GREEN = "\033[0;32m"
RED = "\033[0;31m"
RESET = "\033[0m"
)
func main() {
root_cmd := &cobra.Command{
Use: "gas",
Version: version.String(),
SilenceErrors: true,
SilenceUsage: true,
}
// Print a bare version string ("v0.0.4"), rather than cobra's "gas version v0.0.4".
root_cmd.SetVersionTemplate("{{.Version}}\n")
root_cmd.AddCommand(sqlite_lint)
root_cmd.AddCommand(cmd_init)
root_cmd.AddCommand(generate_model)
root_cmd.AddCommand(cmd_version)
if err := root_cmd.Execute(); err != nil {
fmt.Println(RED + err.Error() + RESET)
os.Exit(1)
}
}