nicolaferraro commented on a change in pull request #1777:
URL: https://github.com/apache/camel-k/pull/1777#discussion_r518096246



##########
File path: pkg/cmd/inspect.go
##########
@@ -89,32 +105,68 @@ func (command *inspectCmdOptions) validate(args []string) 
error {
                }
        }
 
+       // Validate list of additional dependencies i.e. make sure that each 
dependency has
+       // a valid type.
+       if command.AdditionalDependencies != nil {
+               for _, additionalDependency := range 
command.AdditionalDependencies {
+                       dependencyComponents := 
strings.Split(additionalDependency, ":")
+
+                       TypeIsValid := false
+                       for _, dependencyType := range acceptedDependencyTypes {
+                               if dependencyType == dependencyComponents[0] {
+                                       TypeIsValid = true
+                               }
+                       }
+
+                       if !TypeIsValid {
+                               return errors.New("Unexpected type for 
user-provided dependency: " + additionalDependency + ", check command usage for 
valid format.")
+                       }
+
+               }
+       }
+
        return nil
 }
 
 func (command *inspectCmdOptions) run(args []string) error {
-       // Attempt to reuse existing Camel catalog if one is present.
-       catalog, err := camel.MainCatalog()

Review comment:
       `camel.DefaultCatalog()` is better. We're removing main.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to