fix: only show warning once
This commit is contained in:
parent
b287b25f35
commit
5560ea93b1
@ -49,11 +49,18 @@ var (
|
|||||||
"token-expiration-time": "tokenExpirationTime",
|
"token-expiration-time": "tokenExpirationTime",
|
||||||
"baseurl": "baseURL",
|
"baseurl": "baseURL",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
warnedFlags = map[string]bool{}
|
||||||
)
|
)
|
||||||
|
|
||||||
func migrateFlagNames(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
func migrateFlagNames(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||||
if newName, ok := flagNamesMigrations[name]; ok {
|
if newName, ok := flagNamesMigrations[name]; ok {
|
||||||
fmt.Printf("Flag --%s has been deprecated, use --%s instead\n", name, newName)
|
|
||||||
|
if !warnedFlags[name] {
|
||||||
|
warnedFlags[name] = true
|
||||||
|
fmt.Printf("WARNING: Flag --%s has been deprecated, use --%s instead\n", name, newName)
|
||||||
|
}
|
||||||
|
|
||||||
name = newName
|
name = newName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user