-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (41 loc) · 1.1 KB
/
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
43
44
45
46
47
48
49
package main
import (
"fmt"
"os"
"github.com/juju/cmd"
"github.com/juju/loggo"
jujucmd "github.com/juju/juju/cmd"
"github.com/juju/juju/cmd/modelcmd"
"github.com/juju/juju/juju"
)
var logger = loggo.GetLogger("juju.plugins.tools")
const doc = `
Juju tools is used to manage tools in the Juju controller.
This is provided for developers, and is not supported.
`
func main() {
Main(os.Args)
}
// Main registers subcommands for the juju-local executable.
func Main(args []string) {
ctx, err := cmd.DefaultContext()
if err != nil {
logger.Debugf("error: %v\n", err)
os.Exit(2)
}
if err := juju.InitJujuXDGDataHome(); err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n", err)
os.Exit(2)
}
plugin := jujucmd.NewSuperCommand(cmd.SuperCommandParams{
Name: "tools",
UsagePrefix: "juju",
Doc: doc,
Purpose: "manage tools in the controller",
Log: &cmd.Log{},
})
plugin.Register(modelcmd.Wrap(&buildToolsCommand{}))
plugin.Register(modelcmd.Wrap(&uploadToolsCommand{}))
plugin.Register(modelcmd.Wrap(&listToolsCommand{}))
os.Exit(cmd.Main(plugin, ctx, args[1:]))
}