-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathflags.go
More file actions
126 lines (93 loc) · 4.08 KB
/
Copy pathflags.go
File metadata and controls
126 lines (93 loc) · 4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package cmd
import (
"strings"
"github.com/evcc-io/evcc/util/templates"
"github.com/samber/lo"
"github.com/spf13/cobra"
)
const (
flagHeaders = "log-headers"
flagHeadersDescription = "Log headers"
flagDemoMode = "demo"
flagDemoModeDescription = "Enter demo mode. Disables auth, config ui and restart"
flagIgnoreDatabase = "ignore-db"
flagIgnoreDatabaseDescription = "Run command ignoring service database"
flagTemplate = "template"
flagTemplateDescription = "Add custom template file (debug only)"
flagTemplateType = "template-type"
flagDisableAuth = "disable-auth"
flagDisableAuthDescription = "Disable authentication (dangerous)"
flagCustomCss = "custom-css"
flagCustomCssDescription = "Additional user-defined CSS file for custom styling. No compatibility guarantees."
flagCustomLogoLight = "custom-logo-light"
flagCustomLogoLightDescription = "Custom light-mode logo file (svg, png) replacing the evcc logo in the UI. Requires custom-logo-dark."
flagCustomLogoDark = "custom-logo-dark"
flagCustomLogoDarkDescription = "Custom dark-mode logo file (svg, png) replacing the evcc logo in the UI. Requires custom-logo-light."
flagCustomBrand = "custom-brand"
flagCustomBrandDescription = "Custom brand name shown in the UI"
flagCustomWebsite = "custom-website"
flagCustomWebsiteDescription = "Custom website URL shown in the UI"
flagCustomEmail = "custom-email"
flagCustomEmailDescription = "Support email address shown in the UI"
flagCustomPhone = "custom-phone"
flagCustomPhoneDescription = "Support phone number shown in the UI"
flagBatteryMode = "battery-mode"
flagBatteryModeDescription = "Set battery mode (normal, hold, charge, holdcharge, discharge)"
flagBatteryModeWait = "battery-mode-wait"
flagBatteryModeWaitDescription = "Wait given duration during which potential watchdogs are active"
flagCurrent = "current"
flagCurrentDescription = "Set maximum current"
flagPhases = "phases"
flagPhasesDescription = "Set usable phases (1 or 3)"
flagCloud = "cloud"
flagCloudDescription = "Use cloud service (requires sponsor token)"
flagReset = "reset"
flagResetDescription = "Reset migrated settings"
flagEnable = "enable"
flagDisable = "disable"
flagDiagnose = "diagnose"
flagDiagnoseDescription = "Diagnose"
flagCurtail = "curtail"
flagCurtailDescription = "Curtail feed-in to percent (0-100, only available if supported by device)"
flagDim = "dim"
flagDimDescription = "Dim (0/1 to switch, only available if supported by device)"
flagWakeup = "wakeup"
flagWakeupDescription = "Wake up"
flagStart = "start"
flagStartDescription = "Start charging"
flagStop = "stop"
flagStopDescription = "Stop charging"
flagRepeat = "repeat"
flagRepeatDescription = "Repeat until interrupted"
flagRepeatInterval = "repeat-interval"
flagRepeatIntervalDescription = "Interval between repetitions"
flagHeartbeat = "heartbeat"
flagHeartbeatDescription = "After command, continue running device heartbeats (if any) until interrupted"
flagTimeout = "timeout"
flagTimeoutDescription = "Timeout"
flagDigits = "digits"
flagDelay = "delay"
flagForce = "force"
)
var flagTemplateTypeDescription = "Custom template type (" + strings.Join(
lo.Map([]templates.Class{templates.Charger, templates.Meter, templates.Tariff, templates.Vehicle}, func(t templates.Class, _ int) string {
return t.String()
}), ", ") + ") (debug only)"
func bind(cmd *cobra.Command, key string, flagName ...string) {
name := key
if len(flagName) == 1 {
name = flagName[0]
}
if err := viper.BindPFlag(key, cmd.Flag(name)); err != nil {
panic(err)
}
}
func bindP(cmd *cobra.Command, key string, flagName ...string) {
name := key
if len(flagName) == 1 {
name = flagName[0]
}
if err := viper.BindPFlag(key, cmd.PersistentFlags().Lookup(name)); err != nil {
panic(err)
}
}