This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 792e0876cd630d29acbb3426813d9444df8b222e
Author: Doru Bercea <[email protected]>
AuthorDate: Wed Oct 21 16:43:56 2020 -0400

    Only print top-level dependencies if they are requested.
---
 pkg/cmd/inspect.go | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/pkg/cmd/inspect.go b/pkg/cmd/inspect.go
index fbf25c6..cbb823d 100644
--- a/pkg/cmd/inspect.go
+++ b/pkg/cmd/inspect.go
@@ -180,8 +180,11 @@ func (command *inspectCmdOptions) run(args []string) error 
{
        // Fetch existing catalog or create new one if one does not already 
exist.
        catalog, err := createCamelCatalog()
 
+       // Output top-level dependencies.
+       outputTopLevel := !command.AllDependencies
+
        // Get top-level dependencies, this is the default behavior when no 
other options are provided.
-       dependencies, err := getTopLevelDependencies(catalog, 
command.OutputFormat, args)
+       dependencies, err := getTopLevelDependencies(catalog, 
command.OutputFormat, args, outputTopLevel)
        if err != nil {
                return err
        }
@@ -208,7 +211,7 @@ func (command *inspectCmdOptions) run(args []string) error {
        return nil
 }
 
-func getTopLevelDependencies(catalog *camel.RuntimeCatalog, format string, 
args []string) ([]string, error) {
+func getTopLevelDependencies(catalog *camel.RuntimeCatalog, format string, 
args []string, outputTopLevel bool) ([]string, error) {
        // List of top-level dependencies.
        dependencies := strset.New()
 
@@ -236,7 +239,7 @@ func getTopLevelDependencies(catalog *camel.RuntimeCatalog, 
format string, args
                if err != nil {
                        return []string{}, err
                }
-       } else {
+       } else if outputTopLevel {
                // Print output in text form.
                for _, dep := range dependencies.List() {
                        fmt.Printf("%v\n", dep)

Reply via email to