1
// Copyright 2015 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
9
"github.com/juju/juju/cmd/modelcmd"
12
// TODO(ericsnow) Replace all this with a better registry mechanism,
13
// likely over in the cmd repo.
16
registeredCommands []func() cmd.Command
17
registeredEnvCommands []func() modelcmd.ModelCommand
20
// RegisterCommand adds the provided func to the set of those that will
21
// be called when the juju command runs. Each returned command will be
22
// registered with the "juju" supercommand.
23
func RegisterCommand(newCommand func() cmd.Command) {
24
registeredCommands = append(registeredCommands, newCommand)
27
// RegisterEnvCommand adds the provided func to the set of those that will
28
// be called when the juju command runs. Each returned command will be
29
// wrapped in envCmdWrapper, which is what gets registered with the
30
// "juju" supercommand.
31
func RegisterEnvCommand(newCommand func() modelcmd.ModelCommand) {
32
registeredEnvCommands = append(registeredEnvCommands, newCommand)