Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 package main | 1 package main |
2 | 2 |
3 import ( | 3 import ( |
4 "fmt" | 4 "fmt" |
5 "launchpad.net/juju-core/cmd" | 5 "launchpad.net/juju-core/cmd" |
6 "launchpad.net/juju-core/juju" | 6 "launchpad.net/juju-core/juju" |
7 "os" | 7 "os" |
8 ) | 8 ) |
9 | 9 |
10 // When we import an environment provider implementation | 10 // When we import an environment provider implementation |
11 // here, it will register itself with environs, and hence | 11 // here, it will register itself with environs, and hence |
12 // be available to the juju command. | 12 // be available to the juju command. |
13 import ( | 13 import ( |
14 _ "launchpad.net/juju-core/environs/ec2" | 14 _ "launchpad.net/juju-core/environs/ec2" |
15 _ "launchpad.net/juju-core/environs/openstack" | 15 _ "launchpad.net/juju-core/environs/openstack" |
16 ) | 16 ) |
17 | 17 |
18 var jujuDoc = ` | 18 var jujuDoc = ` |
19 juju provides easy, intelligent service orchestration on top of environments | 19 juju provides easy, intelligent service orchestration on top of environments |
20 such as OpenStack, Amazon AWS, or bare metal. | 20 such as OpenStack, Amazon AWS, or bare metal. |
21 | 21 |
22 https://juju.ubuntu.com/ | 22 https://juju.ubuntu.com/ |
23 ` | 23 ` |
24 | 24 |
25 // Main registers subcommands for the juju executable, and hands over control | 25 // Main registers subcommands for the juju executable, and hands over control |
26 // to the cmd package. This function is not redundant with main, because it | 26 // to the cmd package. This function is not redundant with main, because it |
27 // provides an entry point for testing with arbitrary command line arguments. | 27 // provides an entry point for testing with arbitrary command line arguments. |
28 func Main(args []string) { | 28 func Main(args []string) { |
29 if err := juju.InitJujuHome(); err != nil { | 29 if err := juju.InitJujuHome(); err != nil { |
30 » » fmt.Fprintf(os.Stderr, "command failed: "+err.Error()+"\n") | 30 » » fmt.Fprintf(os.Stderr, "error: %s\n", err) |
rog
2013/04/09 16:22:59
fmt.Fprintf(os.Stderr, "error: %s\n", err)
to be
frankban
2013/04/09 16:43:23
Done.
| |
31 » » os.Exit(1) | 31 » » os.Exit(2) |
rog
2013/04/09 16:22:59
i know it was like this before, but i think this s
frankban
2013/04/09 16:43:23
Done.
| |
32 } | 32 } |
33 juju := cmd.NewSuperCommand(cmd.SuperCommandParams{ | 33 juju := cmd.NewSuperCommand(cmd.SuperCommandParams{ |
34 Name: "juju", | 34 Name: "juju", |
35 Doc: jujuDoc, | 35 Doc: jujuDoc, |
36 Log: &cmd.Log{}, | 36 Log: &cmd.Log{}, |
37 }) | 37 }) |
38 juju.AddHelpTopic("basics", "Basic commands", helpBasics) | 38 juju.AddHelpTopic("basics", "Basic commands", helpBasics) |
39 | 39 |
40 » // Register creation commands. | 40 » // Creation commands. |
41 juju.Register(&BootstrapCommand{}) | 41 juju.Register(&BootstrapCommand{}) |
42 juju.Register(&DeployCommand{}) | 42 juju.Register(&DeployCommand{}) |
43 juju.Register(&AddRelationCommand{}) | 43 juju.Register(&AddRelationCommand{}) |
44 juju.Register(&AddUnitCommand{}) | 44 juju.Register(&AddUnitCommand{}) |
45 | 45 |
46 » // Register destruction commands. | 46 » // Destruction commands. |
47 juju.Register(&DestroyMachineCommand{}) | 47 juju.Register(&DestroyMachineCommand{}) |
48 juju.Register(&DestroyRelationCommand{}) | 48 juju.Register(&DestroyRelationCommand{}) |
49 juju.Register(&DestroyServiceCommand{}) | 49 juju.Register(&DestroyServiceCommand{}) |
50 juju.Register(&DestroyUnitCommand{}) | 50 juju.Register(&DestroyUnitCommand{}) |
51 juju.Register(&DestroyEnvironmentCommand{}) | 51 juju.Register(&DestroyEnvironmentCommand{}) |
52 | 52 |
53 » // Register error resolution commands. | 53 » // Error resolution commands. |
54 juju.Register(&StatusCommand{}) | 54 juju.Register(&StatusCommand{}) |
55 juju.Register(&SCPCommand{}) | 55 juju.Register(&SCPCommand{}) |
56 juju.Register(&SSHCommand{}) | 56 juju.Register(&SSHCommand{}) |
57 juju.Register(&ResolvedCommand{}) | 57 juju.Register(&ResolvedCommand{}) |
58 juju.Register(&DebugLogCommand{sshCmd: &SSHCommand{}}) | 58 juju.Register(&DebugLogCommand{sshCmd: &SSHCommand{}}) |
59 | 59 |
60 » // Register configuration commands. | 60 » // Configuration commands. |
61 juju.Register(&InitCommand{}) | 61 juju.Register(&InitCommand{}) |
62 juju.Register(&GetCommand{}) | 62 juju.Register(&GetCommand{}) |
63 juju.Register(&SetCommand{}) | 63 juju.Register(&SetCommand{}) |
64 juju.Register(&GetConstraintsCommand{}) | 64 juju.Register(&GetConstraintsCommand{}) |
65 juju.Register(&SetConstraintsCommand{}) | 65 juju.Register(&SetConstraintsCommand{}) |
66 juju.Register(&ExposeCommand{}) | 66 juju.Register(&ExposeCommand{}) |
67 juju.Register(&SyncToolsCommand{}) | 67 juju.Register(&SyncToolsCommand{}) |
68 juju.Register(&UnexposeCommand{}) | 68 juju.Register(&UnexposeCommand{}) |
69 juju.Register(&UpgradeJujuCommand{}) | 69 juju.Register(&UpgradeJujuCommand{}) |
70 juju.Register(&UpgradeCharmCommand{}) | 70 juju.Register(&UpgradeCharmCommand{}) |
71 | 71 |
72 » // register common commands | 72 » // Charm publishing commands. |
73 » juju.Register(&PublishCommand{}) | |
74 | |
75 » // Common commands. | |
73 juju.Register(&cmd.VersionCommand{}) | 76 juju.Register(&cmd.VersionCommand{}) |
74 | 77 |
75 os.Exit(cmd.Main(juju, cmd.DefaultContext(), args[1:])) | 78 os.Exit(cmd.Main(juju, cmd.DefaultContext(), args[1:])) |
76 } | 79 } |
77 | 80 |
78 func main() { | 81 func main() { |
79 Main(os.Args) | 82 Main(os.Args) |
80 } | 83 } |
LEFT | RIGHT |