cmd: use hyphen instead of underscore (#3898)

This commit is contained in:
fatedier
2023-12-27 10:44:13 +08:00
committed by GitHub
parent 596262d5e0
commit d01f4a3ec1
7 changed files with 23 additions and 9 deletions

View File

@@ -17,14 +17,24 @@ package config
import (
"fmt"
"strconv"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/fatedier/frp/pkg/config/types"
v1 "github.com/fatedier/frp/pkg/config/v1"
"github.com/fatedier/frp/pkg/config/v1/validation"
)
// WordSepNormalizeFunc changes all flags that contain "_" separators
func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
if strings.Contains(name, "_") {
return pflag.NormalizedName(strings.ReplaceAll(name, "_", "-"))
}
return pflag.NormalizedName(name)
}
type RegisterFlagOption func(*registerFlagOptions)
type registerFlagOptions struct {