essobedo commented on code in PR #3599:
URL: https://github.com/apache/camel-k/pull/3599#discussion_r962672112


##########
pkg/cmd/config.go:
##########
@@ -0,0 +1,163 @@
+/*
+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"
+       "os"
+       "path/filepath"
+
+       "github.com/spf13/cobra"
+       "github.com/spf13/viper"
+       "gopkg.in/yaml.v2"
+)
+
+// ConfigFolder defines the different types of folder containing the 
configuration file
+type ConfigFolder string
+
+const (
+       // The path of the folder containing the configuration file is 
retrieved from the environment
+       // variable KAMEL_CONFIG_PATH
+       ConfigFolderEnvVar ConfigFolder = "env"
+       // The path of the folder containing the configuration file is 
$HOME/.kamel
+       ConfigFolderHome ConfigFolder = "home"
+       // The folder containing the configuration file is .kamel located in 
the working directory
+       ConfigFolderSubDirectory ConfigFolder = "sub"
+       // The folder containing the configuration file is the working directory
+       ConfigFolderWorking ConfigFolder = "working"
+       // The folder containing the configuration file is the directory 
currently used by the kamel script
+       ConfigFolderUsed ConfigFolder = "used"
+)
+
+func newCmdConfig(rootCmdOptions *RootCmdOptions) (*cobra.Command, 
*configCmdOptions) {
+       options := configCmdOptions{}
+       cmd := cobra.Command{
+               Use:     "config",
+               Short:   "Configure the default settings",
+               PreRunE: decode(&options),
+               Args:    options.validateArgs,
+               RunE:    options.run,
+       }
+
+       cmd.Flags().String("folder", "used", "The type of folder containing the 
configuration file to read/write. The supported values are env, home, sub, 
working and used for respectively $KAMEL_CONFIG_PATH, $HOME/.kamel, .kamel, . 
and the folder used by kamel")

Review Comment:
   It is to be able to indicate where you want to set/read the settings as they 
are 4 possible locations (working directory, home directory, 
`$KAMEL_CONFIG_PATH` or `.kamel` in the working directory). The value `used` is 
to be able to list the settings that are used in practice by the CLI since it 
can quickly be confusing where the config is read from. That's why when I list 
the settings, I also give the location. I don't know if it is clear enough now?



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to