camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nferr...@apache.org
Subject [camel-k] 02/03: chore(kamel): fix completion generation
Date Sat, 15 Sep 2018 14:25:06 GMT
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 dc17a2d23d1947fb8bb433f22fd170a780f7a830
Author: lburgazzoli <lburgazzoli@gmail.com>
AuthorDate: Sat Sep 15 00:41:05 2018 +0200

    chore(kamel): fix completion generation
---
 pkg/client/cmd/completion.go | 5 +++--
 pkg/client/cmd/root.go       | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/pkg/client/cmd/completion.go b/pkg/client/cmd/completion.go
index 3429dad..f86bd0b 100644
--- a/pkg/client/cmd/completion.go
+++ b/pkg/client/cmd/completion.go
@@ -34,13 +34,14 @@ To configure your bash shell to load completions for each session add
to your ba
 . <(kamel completion)
 `
 
-func NewCmdCompletion() *cobra.Command {
+// NewCmdCompletion --
+func NewCmdCompletion(root *cobra.Command) *cobra.Command {
 	return &cobra.Command{
 		Use:   "completion",
 		Short: "Generates bash completion scripts",
 		Long:  completionCmdLongDescription,
 		Run: func(cmd *cobra.Command, args []string) {
-			cmd.GenBashCompletion(os.Stdout)
+			root.GenBashCompletion(os.Stdout)
 		},
 	}
 }
diff --git a/pkg/client/cmd/root.go b/pkg/client/cmd/root.go
index 50cfb40..3168cc2 100644
--- a/pkg/client/cmd/root.go
+++ b/pkg/client/cmd/root.go
@@ -20,10 +20,11 @@ package cmd
 import (
 	"os"
 
+	"context"
+
 	"github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
-	"context"
 )
 
 type RootCmdOptions struct {
@@ -62,7 +63,7 @@ func NewKamelCommand(ctx context.Context) (*cobra.Command, error) {
 		return nil, err
 	}
 
-	cmd.AddCommand(NewCmdCompletion())
+	cmd.AddCommand(NewCmdCompletion(&cmd))
 	cmd.AddCommand(NewCmdVersion())
 	cmd.AddCommand(NewCmdRun(&options))
 	cmd.AddCommand(NewCmdGet(&options))


Mime
View raw message