-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (33 loc) · 767 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
35
36
37
38
39
40
41
42
package main
import (
"fmt"
"os"
"github.com/jngreenwood/nazgul/command"
"github.com/mitchellh/cli"
)
func main() {
os.Exit(Run(os.Args[1:]))
}
func Run(args []string) int {
agentUi := &cli.BasicUi{
Reader: os.Stdin,
Writer: os.Stdout,
ErrorWriter: os.Stderr,
}
commands := command.Commands(agentUi)
cli := &cli.CLI{
Name: "nazgul",
Version: "0.0.1",
Args: args,
Commands: commands,
Autocomplete: true,
AutocompleteNoDefaultFlags: true,
HelpWriter: os.Stdout,
}
exitCode, err := cli.Run()
if err != nil {
fmt.Fprintf(os.Stderr, "Error executing CLI: %s\n", err.Error())
return 1
}
return exitCode
}