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

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

commit a3a58ebbe6984c076ee0cd0749414bed7ea6c26b
Author: Antonin Stefanutti <anto...@stefanutti.fr>
AuthorDate: Tue Jun 1 10:37:42 2021 +0200

    chore(cli): Rename local Maven repository option
---
 pkg/cmd/install.go      |  8 ++++----
 pkg/cmd/install_test.go | 21 +++++++--------------
 2 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index bfc9ac0..5c63979 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -112,7 +112,7 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) 
(*cobra.Command, *installCmdO
                "operator (used in combination with the --global flag)")
 
        // Maven
-       cmd.Flags().String("local-repository", "", "Location of the local Maven 
repository")
+       cmd.Flags().String("maven-local-repository", "", "Path of the local 
Maven repository")
        cmd.Flags().StringArray("maven-property", nil, "Add a Maven property")
        cmd.Flags().String("maven-settings", "", "Configure the source of the 
Maven settings (configmap|secret:name[/key])")
        cmd.Flags().StringArray("maven-repository", nil, "Add a Maven 
repository")
@@ -163,10 +163,10 @@ type installCmdOptions struct {
        BaseImage               string   `mapstructure:"base-image"`
        OperatorImage           string   `mapstructure:"operator-image"`
        OperatorImagePullPolicy string   
`mapstructure:"operator-image-pull-policy"`
-       LocalRepository         string   `mapstructure:"local-repository"`
        BuildStrategy           string   `mapstructure:"build-strategy"`
        BuildPublishStrategy    string   `mapstructure:"build-publish-strategy"`
        BuildTimeout            string   `mapstructure:"build-timeout"`
+       MavenLocalRepository    string   `mapstructure:"maven-local-repository"`
        MavenProperties         []string `mapstructure:"maven-properties"`
        MavenRepositories       []string `mapstructure:"maven-repositories"`
        MavenSettings           string   `mapstructure:"maven-settings"`
@@ -321,8 +321,8 @@ func (o *installCmdOptions) install(cobraCmd 
*cobra.Command, _ []string) error {
                                }
                        }
                }
-               if o.LocalRepository != "" {
-                       platform.Spec.Build.Maven.LocalRepository = 
o.LocalRepository
+               if o.MavenLocalRepository != "" {
+                       platform.Spec.Build.Maven.LocalRepository = 
o.MavenLocalRepository
                }
                if o.RuntimeVersion != "" {
                        platform.Spec.Build.RuntimeVersion = o.RuntimeVersion
diff --git a/pkg/cmd/install_test.go b/pkg/cmd/install_test.go
index 3918931..aae198c 100644
--- a/pkg/cmd/install_test.go
+++ b/pkg/cmd/install_test.go
@@ -20,13 +20,12 @@ package cmd
 import (
        "testing"
 
-       "github.com/apache/camel-k/pkg/util/olm"
-       "github.com/apache/camel-k/pkg/util/test"
        "github.com/spf13/cobra"
+       "github.com/stretchr/testify/assert"
 
        v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
-
-       "github.com/stretchr/testify/assert"
+       "github.com/apache/camel-k/pkg/util/olm"
+       "github.com/apache/camel-k/pkg/util/test"
 )
 
 const cmdInstall = "install"
@@ -40,7 +39,7 @@ func initializeInstallCmdOptions(t *testing.T) 
(*installCmdOptions, *cobra.Comma
 }
 
 func addTestInstallCmd(options RootCmdOptions, rootCmd *cobra.Command) 
*installCmdOptions {
-       //add a testing version of install Command
+       // Add a testing version of install Command
        installCmd, installOptions := newCmdInstall(&options)
        installCmd.RunE = func(c *cobra.Command, args []string) error {
                return nil
@@ -57,7 +56,7 @@ func TestInstallNoFlag(t *testing.T) {
        installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
        _, err := test.ExecuteCommand(rootCmd, cmdInstall)
        assert.Nil(t, err)
-       //Check default expected values
+       // Check default expected values
        assert.Equal(t, false, installCmdOptions.Wait)
        assert.Equal(t, false, installCmdOptions.ClusterSetupOnly)
        assert.Equal(t, false, installCmdOptions.SkipOperatorSetup)
@@ -170,9 +169,9 @@ func TestInstallKanikoBuildCacheFlag(t *testing.T) {
 
 func TestInstallLocalRepositoryFlag(t *testing.T) {
        installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
-       _, err := test.ExecuteCommand(rootCmd, cmdInstall, 
"--local-repository", "someString")
+       _, err := test.ExecuteCommand(rootCmd, cmdInstall, 
"--maven-local-repository", "someString")
        assert.Nil(t, err)
-       assert.Equal(t, "someString", installCmdOptions.LocalRepository)
+       assert.Equal(t, "someString", installCmdOptions.MavenLocalRepository)
 }
 
 func TestInstallMavenRepositoryFlag(t *testing.T) {
@@ -333,9 +332,7 @@ func TestDecodeMavenSettings(t *testing.T) {
        var err error
        var val v1.ValueSource
 
-       //
        // ConfigMap
-       //
        val, err = decodeMavenSettings("configmap:maven-settings/s.xml")
        assert.Nil(t, err)
        assert.Nil(t, val.SecretKeyRef)
@@ -348,9 +345,7 @@ func TestDecodeMavenSettings(t *testing.T) {
        assert.Equal(t, "maven-settings", val.ConfigMapKeyRef.Name)
        assert.Empty(t, val.ConfigMapKeyRef.Key)
 
-       //
        // Secrets
-       //
        val, err = decodeMavenSettings("secret:maven-settings-secret/s.xml")
        assert.Nil(t, err)
        assert.Nil(t, val.ConfigMapKeyRef)
@@ -363,9 +358,7 @@ func TestDecodeMavenSettings(t *testing.T) {
        assert.Equal(t, "maven-settings-secret", val.SecretKeyRef.Name)
        assert.Empty(t, val.SecretKeyRef.Key)
 
-       //
        // Errors
-       //
        _, err = decodeMavenSettings("something:maven-settings-secret/s.xml")
        assert.NotNil(t, err)
        _, err = decodeMavenSettings("secret")

Reply via email to