sflag

package module
v0.0.0-...-eb22d3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2024 License: GPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const TagKey = "flag"

TagKey is the key used to retrieve informations about the flag in the struct field tag. The value associated with the tag key must be a comma separated list of three items:

  • the name of the flag
  • the default value for the flag
  • the usage message for the flag

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(fs *flag.FlagSet, s any)

AddFlags adds flags to fs according to the tags of the struct contained in s.

func SetFromFlags

func SetFromFlags(s any, fs *flag.FlagSet)

SetFromFlags sets the value of the fields in the struct contained in s with the value of the flags defined in fs. It uses the tag of the struct fields to determine the fields whose value should be set and to determine the corresponding flag to use.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL