Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Added the list-resources subcmd. #6
Conversation
|
Test PASSed. |
ericsnowcurrently
reviewed
Mar 21, 2016
| @@ -86,6 +90,12 @@ type csClient struct { | ||
| filler esform.Filler | ||
| } | ||
| +// SaveJAR calls save on the jar member variable. This follows the Law | ||
| +// of Demeter and allows csClient to meet interfaces. | ||
| +func (c *csClient) SaveJAR() error { |
ericsnowcurrently
Mar 21, 2016
We really need to pull out the common code between this and core. (but not here)
ericsnowcurrently
reviewed
Mar 21, 2016
| + formatTabular func(interface{}) ([]byte, error), | ||
| + username, | ||
| + password string, | ||
| + charmID *charm.URL, |
ericsnowcurrently
reviewed
Mar 21, 2016
| + | ||
| +var info = cmd.Info{ | ||
| + Name: "list-resources", | ||
| + Args: "<charm> [--channel <channel>]", |
ericsnowcurrently
reviewed
Mar 21, 2016
| +`, | ||
| +} | ||
| + | ||
| +type ListResourcesCharmstoreClient interface { |
ericsnowcurrently
reviewed
Mar 21, 2016
| + SaveJAR() error | ||
| +} | ||
| + | ||
| +type NewCharmstoreClientFn func(*cmd.Context, string, string) (ListResourcesCharmstoreClient, error) |
natefinch
Mar 21, 2016
Contributor
Can you put names on the arguments? Otherwise I don't know what the two strings are for.
ericsnowcurrently
reviewed
Mar 21, 2016
| + cmd.CommandBase | ||
| + cmd.Output | ||
| + | ||
| + NewCharmstoreClient NewCharmstoreClientFn |
ericsnowcurrently
reviewed
Mar 21, 2016
| + password string | ||
| +} | ||
| + | ||
| +func (c *listResourcesCommand) Info() *cmd.Info { |
ericsnowcurrently
reviewed
Mar 21, 2016
| + "launchpad.net/gnuflag" | ||
| +) | ||
| + | ||
| +var info = cmd.Info{ |
ericsnowcurrently
reviewed
Mar 21, 2016
| +} | ||
| + | ||
| +func parseArgs(auth string, args []string) (string, string, *charm.URL, error) { | ||
| + // The valid combination of arguments is 1 or 3. |
ericsnowcurrently
reviewed
Mar 21, 2016
| +func parseArgs(auth string, args []string) (string, string, *charm.URL, error) { | ||
| + // The valid combination of arguments is 1 or 3. | ||
| + if len(args) != 1 { | ||
| + return "", "", nil, errgo.New("no charm ID specified") |
ericsnowcurrently
Mar 21, 2016
The established pattern is to use cmd.CheckEmpty() after popping off the expected arg.
natefinch
reviewed
Mar 21, 2016
| + Args: "<charm> [--channel <channel>]", | ||
| + Purpose: "display the resources for a charm in the charm store", | ||
| + Doc: ` | ||
| +This command will report the resources for a charm in the charm store. |
natefinch
reviewed
Mar 21, 2016
| +This command will report the resources for a charm in the charm store. | ||
| + | ||
| +<charm> can be a charm URL, or an unambiguously condensed form of it, | ||
| +just like the deploy command. So the following forms will be accepted: |
natefinch
Mar 21, 2016
Contributor
I don't think we should reference the deploy command, since that's a juju command not a charm command.
ericsnowcurrently
commented
Mar 21, 2016
|
Other than a few minor comments, LGTM. |
natefinch
reviewed
Mar 21, 2016
| +For cs:~user/trusty/mysql | ||
| + cs:~user/mysql | ||
| + | ||
| +Where the series is not supplied, the series from your local host is used. |
natefinch
Mar 21, 2016
Contributor
Is this true? I don't see code that does that, but I may be missing something.
natefinch
reviewed
Mar 21, 2016
| + "launchpad.net/gnuflag" | ||
| +) | ||
| + | ||
| +type listResourcesSuite struct { |
|
Test PASSed. |
natefinch
reviewed
Mar 21, 2016
| + return c.Write(ctx, resources) | ||
| +} | ||
| + | ||
| +func parseArgs(auth string, args []string) (string, string, *charm.URL, error) { |
ericsnowcurrently
commented
Mar 21, 2016
|
Thanks for taking care of that. LGTM. |
|
|
|
Status: merge request accepted. Url: http://ci.jujugui.org:8080/job/charmstore-client-merge |
kat-co commentedMar 21, 2016
No description provided.