Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(784)

Side by Side Diff: cmd/juju/get.go

Issue 6532045: cmd: add cmd.Context to command.Init (Closed)
Patch Set: Created 12 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cmd/juju/expose_test.go ('k') | cmd/juju/set.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package main 1 package main
2 2
3 import ( 3 import (
4 "errors" 4 "errors"
5 "reflect" 5 "reflect"
6 6
7 "launchpad.net/gnuflag" 7 "launchpad.net/gnuflag"
8 "launchpad.net/juju-core/charm" 8 "launchpad.net/juju-core/charm"
9 "launchpad.net/juju-core/cmd" 9 "launchpad.net/juju-core/cmd"
10 "launchpad.net/juju-core/juju" 10 "launchpad.net/juju-core/juju"
11 ) 11 )
12 12
13 // GetCommand retrieves the configuration of a service. 13 // GetCommand retrieves the configuration of a service.
14 type GetCommand struct { 14 type GetCommand struct {
15 EnvName string 15 EnvName string
16 ServiceName string 16 ServiceName string
17 out cmd.Output 17 out cmd.Output
18 } 18 }
19 19
20 func (c *GetCommand) Info() *cmd.Info { 20 func (c *GetCommand) Info() *cmd.Info {
21 return &cmd.Info{"get", "", "get service config options", ""} 21 return &cmd.Info{"get", "", "get service config options", ""}
22 } 22 }
23 23
24 func (c *GetCommand) Init(f *gnuflag.FlagSet, args []string) error { 24 func (c *GetCommand) Init(f *gnuflag.FlagSet, args []string, _ *cmd.Context) err or {
25 addEnvironFlags(&c.EnvName, f) 25 addEnvironFlags(&c.EnvName, f)
26 // TODO(dfc) add json formatting ? 26 // TODO(dfc) add json formatting ?
27 c.out.AddFlags(f, "yaml", map[string]cmd.Formatter{ 27 c.out.AddFlags(f, "yaml", map[string]cmd.Formatter{
28 "yaml": cmd.FormatYaml, 28 "yaml": cmd.FormatYaml,
29 }) 29 })
30 // TODO(dfc) add --schema-only 30 // TODO(dfc) add --schema-only
31 if err := f.Parse(true, args); err != nil { 31 if err := f.Parse(true, args); err != nil {
32 return err 32 return err
33 } 33 }
34 args = f.Args() 34 args = f.Args()
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 if v.Default != nil { 88 if v.Default != nil {
89 if reflect.DeepEqual(v.Default, svcfg[k]) { 89 if reflect.DeepEqual(v.Default, svcfg[k]) {
90 m["default"] = true 90 m["default"] = true
91 } 91 }
92 } 92 }
93 r[k] = m 93 r[k] = m
94 } 94 }
95 return r 95 return r
96 } 96 }
OLDNEW
« no previous file with comments | « cmd/juju/expose_test.go ('k') | cmd/juju/set.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b