Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

updated cobra and switched some code to use Args concept #81

Merged
merged 1 commit into from
Sep 12, 2017

Conversation

aaron-prindle
Copy link
Collaborator

No description provided.

nkubala
nkubala previously approved these changes Sep 12, 2017
cmd/analyze.go Outdated
if len(args) != 1 {
errMessage = "'analyze' requires one image as an argument: container analyze [image]"
glog.Errorf(errMessage)
errMessage := "'analyze' requires one image as an argument: container analyze [image]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: don't even need to make this var here, just instantiate the new error with the string directly

@aaron-prindle
Copy link
Collaborator Author

Incorporated feedback, this should be ready to merge

@nkubala nkubala merged commit 32b0eaa into GoogleContainerTools:master Sep 12, 2017
@@ -27,6 +27,7 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version of container-diff",
Long: `Print the version of container-diff.`,
Args: cobra.ExactArgs(0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, we should use this in minikube to replace some boilerplate

@@ -32,15 +32,16 @@ var analyzeCmd = &cobra.Command{
Use: "analyze",
Short: "Analyzes an image: [image]",
Long: `Analyzes an image using the specifed analyzers as indicated via flags (see documentation for available ones).`,
Run: func(cmd *cobra.Command, args []string) {
Args: func(cmd *cobra.Command, args []string) error {
if err := validateArgs(args, checkAnalyzeArgNum, checkArgType); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets make an issue to replace the "arg count and type checking" to be their own flag types.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants