Documentation
¶
Index ¶
- func GetBool(fs *flag.FlagSet, name string, defaultValue bool) bool
- func GetBoolPflag(fs *pflag.FlagSet, name string, defaultValue bool) bool
- func GetDuration(fs *flag.FlagSet, name string, defaultValue time.Duration) time.Duration
- func GetDurationPflag(fs *pflag.FlagSet, name string, defaultValue time.Duration) time.Duration
- func GetFlagValue(fs *flag.FlagSet, name string) (string, bool)
- func GetFlagValuePflag(fs *pflag.FlagSet, name string) (string, bool)
- func GetFloat64(fs *flag.FlagSet, name string, defaultValue float64) float64
- func GetInt(fs *flag.FlagSet, name string, defaultValue int) int
- func GetInt64(fs *flag.FlagSet, name string, defaultValue int64) int64
- func GetInt64Pflag(fs *pflag.FlagSet, name string, defaultValue int64) int64
- func GetIntPflag(fs *pflag.FlagSet, name string, defaultValue int) int
- func GetString(fs *flag.FlagSet, name, defaultValue string) string
- func GetStringPflag(fs *pflag.FlagSet, name, defaultValue string) string
- func GetUint(fs *flag.FlagSet, name string, defaultValue uint) uint
- func GetUint64(fs *flag.FlagSet, name string, defaultValue uint64) uint64
- func HasFlag(fs *flag.FlagSet, name string) bool
- func HasFlagInArgs(args []string, name string) bool
- func HasFlagInOSArgs(name string) bool
- func HasFlagPflag(fs *pflag.FlagSet, name string) bool
- func ReadPasswordFromFile(filePath string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBoolPflag ¶ added in v1.4.0
GetBoolPflag returns flag value as bool or defaultValue when not set/invalid.
func GetDuration ¶
GetDuration returns flag value as time.Duration or defaultValue when not set/invalid.
func GetDurationPflag ¶ added in v1.4.0
GetDurationPflag returns flag value as time.Duration or defaultValue when not set/invalid.
func GetFlagValue ¶
GetFlagValue returns the string value for a flag if it was set.
func GetFlagValuePflag ¶ added in v1.4.0
GetFlagValuePflag returns the string value for a flag if it was set.
func GetFloat64 ¶
GetFloat64 returns flag value as float64 or defaultValue when not set/invalid.
func GetInt64Pflag ¶ added in v1.4.0
GetInt64Pflag returns flag value as int64 or defaultValue when not set/invalid.
func GetIntPflag ¶ added in v1.4.0
GetIntPflag returns flag value as int or defaultValue when not set/invalid.
func GetStringPflag ¶ added in v1.4.0
GetStringPflag returns flag value or defaultValue when not set.
func HasFlagInArgs ¶
HasFlagInArgs checks if a flag is present in args (supports -name, --name, -name=value, --name=value)
func HasFlagInOSArgs ¶
HasFlagInOSArgs checks if a flag is present in os.Args
func HasFlagPflag ¶ added in v1.4.0
HasFlagPflag checks if a command-line flag is set in the given pflag.FlagSet. It returns true if the flag was explicitly set (e.g. --port 8080 or -p 8080).
func ReadPasswordFromFile ¶
ReadPasswordFromFile reads password from file (security improvement). Path is validated with path traversal check; relative paths are resolved to absolute. File content is trimmed of leading and trailing whitespace.
Types ¶
This section is empty.