lburgazzoli commented on a change in pull request #1757: URL: https://github.com/apache/camel-k/pull/1757#discussion_r508645637
########## File path: pkg/cmd/inspect.go ########## @@ -0,0 +1,207 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cmd + +import ( + "errors" + "fmt" + "path" + + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" + "github.com/apache/camel-k/pkg/trait" + "github.com/apache/camel-k/pkg/util" + "github.com/apache/camel-k/pkg/util/camel" + "github.com/apache/camel-k/pkg/util/maven" + "github.com/scylladb/go-set/strset" + "github.com/spf13/cobra" +) + +func newCmdInspect(rootCmdOptions *RootCmdOptions) (*cobra.Command, *inspectCmdOptions) { + options := inspectCmdOptions{ + RootCmdOptions: rootCmdOptions, + } + + cmd := cobra.Command{ + Use: "inspect [files to inspect]", + Short: "Generate dependencies list the given integration files.", + Long: `Compute and emit the dependencies for a list of integration files.`, + PreRunE: decode(&options), + RunE: func(_ *cobra.Command, args []string) error { + if err := options.validate(args); err != nil { + return err + } + if err := options.run(args); err != nil { + fmt.Println(err.Error()) + } + + return nil + }, + } + + cmd.Flags().StringP("output", "o", "", "Output format. One of: json|yaml") + // TODO: support the following options: + cmd.Flags().Bool("all-dependencies", false, "Include both top level and transitive dependencies.") + cmd.Flags().String("dependencies-directory", "", "If set, directory will contain all integration dependencies.") + cmd.Flags().String("additional-dependencies", "", "Comma separated list of additional dependencies.") + + return &cmd, &options +} + +type inspectCmdOptions struct { + *RootCmdOptions + AllDependencies bool `mapstructure:"all-dependencies"` + OutputFormat string `mapstructure:"output"` + DependenciesDirectory string `mapstructure:"dependencies-directory"` + AdditionalDependencies string `mapstructure:"additional-dependencies"` Review comment: looks like `AllDependencies`, `DependenciesDirectory`, `AdditionalDependencies` are not taken into account at this stage, can we remove them ? ---------------------------------------------------------------- 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