- Add `--advanced` mode, where params defined as `advanced: true` will be asked - Add support for handling user input for lists, e.g. `identifiers` - Bool values are now a No/Yes selection instead of text input - Common definitions (params and render) are moved into single `parambaselist.yaml` file - Some refactoring
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package cmd
|
|
|
|
import (
|
|
_ "embed"
|
|
|
|
"github.com/evcc-io/evcc/cmd/configure"
|
|
"github.com/evcc-io/evcc/util"
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
// configureCmd represents the configure command
|
|
var configureCmd = &cobra.Command{
|
|
Use: "configure",
|
|
Short: "Create an EVCC configuration",
|
|
Run: runConfigure,
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(configureCmd)
|
|
configureCmd.Flags().String("lang", "", "Define the localization to be used (en, de)")
|
|
configureCmd.Flags().Bool("advanced", false, "Enables handling of advanced configuration options")
|
|
configureCmd.Flags().Bool("expand", false, "Enables rendering expanded configuration files")
|
|
}
|
|
|
|
func runConfigure(cmd *cobra.Command, args []string) {
|
|
impl := &configure.CmdConfigure{}
|
|
|
|
lang, err := cmd.Flags().GetString("lang")
|
|
if err != nil {
|
|
log.FATAL.Fatal(err)
|
|
}
|
|
|
|
advanced, err := cmd.Flags().GetBool("advanced")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
expand, err := cmd.Flags().GetBool("expand")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
util.LogLevel(viper.GetString("log"), nil)
|
|
|
|
impl.Run(log, lang, advanced, expand)
|
|
}
|