feat: alert user for deprecated flag
This commit is contained in:
parent
8242aff36b
commit
c25a5e9f1d
@ -37,7 +37,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
cfgFile string
|
cfgFile string
|
||||||
|
|
||||||
flatNamesMigrations = map[string]string{
|
flagNamesMigrations = map[string]string{
|
||||||
"file-mode": "fileMode",
|
"file-mode": "fileMode",
|
||||||
"dir-mode": "dirMode",
|
"dir-mode": "dirMode",
|
||||||
"hide-login-button": "hideLoginButton",
|
"hide-login-button": "hideLoginButton",
|
||||||
@ -56,7 +56,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func migrateFlagNames(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
func migrateFlagNames(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||||
if newName, ok := flatNamesMigrations[name]; ok {
|
if newName, ok := flagNamesMigrations[name]; ok {
|
||||||
|
fmt.Printf("Flag --%s has been deprecated, use --%s instead\n", name, newName)
|
||||||
name = newName
|
name = newName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user