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 6b7caf55b8487c6afb2eb96dc4b08b3a80dd3bad
Author: Ioannis Polyzos <i.poly...@gmail.com>
AuthorDate: Tue Feb 4 22:44:50 2020 +0000

    add 'logs' alias on 'log' cmd
---
 pkg/cmd/log.go      |  1 +
 pkg/cmd/log_test.go | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/pkg/cmd/log.go b/pkg/cmd/log.go
index 8378c37..f92ed98 100644
--- a/pkg/cmd/log.go
+++ b/pkg/cmd/log.go
@@ -36,6 +36,7 @@ func newCmdLog(rootCmdOptions *RootCmdOptions) 
(*cobra.Command, *logCmdOptions)
                Use:     "log integration",
                Short:   "Print the logs of an integration",
                Long:    `Print the logs of an integration.`,
+               Aliases: []string{"logs"},
                Args:    options.validate,
                PreRunE: decode(&options),
                RunE:    options.run,
diff --git a/pkg/cmd/log_test.go b/pkg/cmd/log_test.go
new file mode 100644
index 0000000..c897839
--- /dev/null
+++ b/pkg/cmd/log_test.go
@@ -0,0 +1,21 @@
+package cmd
+
+import (
+       "github.com/apache/camel-k/pkg/util/test"
+       "testing"
+)
+
+func TestLogsAlias(t *testing.T) {
+       options, rootCommand := kamelTestPreAddCommandInit()
+       logCommand, _ := newCmdLog(options)
+       rootCommand.AddCommand(logCommand)
+
+       kamelTestPostAddCommandInit(t, rootCommand)
+
+       _, err := test.ExecuteCommand(rootCommand, "logs")
+
+       //in case of error we expect this to be the log default message
+       if err != nil && err.Error() != "log expects an integration name 
argument" {
+               t.Fatalf("Expected error result for invalid alias `logs`")
+       }
+}

Reply via email to