-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (28 loc) · 777 Bytes
/
main.go
File metadata and controls
34 lines (28 loc) · 777 Bytes
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 IBM Corp. 2020, 2025
// 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)
}