Dies ist eine experimentelle Umsetzung im folgenden aufgeführten Ziele. Wie es verwendet: - Start über `evcc configure` - Die Konfiguration wird in evcc.yaml geschrieben. Falls diese existiert kann ein alternativer Dateiname angegeben werden Was es kann: - Eine geführte Erstellung der Konfigurationsdatei - Direktes Testen ob die Konfiguration jedes Gerätes auch funktioniert - Konfigurationsabhängigkeiten durch direkte Konfiguration der Abhängigkeit lösen (z.B. Sponsorshipt required) - Konfiguration in für Anwender bekannte Informationen und möglichst wenig Informationseingabe zu ermöglichen, z.B. anhand von Produkten anstatt aus der Implementierungssicht - Bisherige Konfiguration funktioniert weiter
41 lines
900 B
Go
41 lines
900 B
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("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)
|
|
}
|
|
|
|
expand, err := cmd.Flags().GetBool("expand")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
util.LogLevel(viper.GetString("log"), nil)
|
|
|
|
impl.Run(log, lang, expand)
|
|
}
|