forked from hashicorp/nomad-autoscaler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
34 lines (28 loc) · 776 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package main
import (
"fmt"
"os"
"github.com/hashicorp/nomad-autoscaler/command"
"github.com/hashicorp/nomad-autoscaler/version"
"github.com/mitchellh/cli"
)
func main() {
versionString := fmt.Sprintf("Nomad Autoscaler %s", version.GetHumanVersion())
c := cli.NewCLI("nomad-autoscaler", versionString)
c.Args = os.Args[1:]
c.Commands = map[string]cli.CommandFactory{
"agent": func() (cli.Command, error) {
return &command.AgentCommand{}, nil
},
"version": func() (cli.Command, error) {
return &command.VersionCommand{Version: versionString}, nil
},
}
exitCode, err := c.Run()
if err != nil {
fmt.Fprintf(os.Stderr, "Error executing CLI: %v\n", err)
}
os.Exit(exitCode)
}