Skip to content

Commit ab2d097

Browse files
committed
Include tag in description
1 parent 6876699 commit ab2d097

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,14 @@ the field should be ignored and no flag is declared. For example,
174174
Host string `flag:"server_address"
175175
GetsIgnored string `flag:""`
176176
177-
To help with organization, struct fields can be flattened such that the resolved flag name does not include the name of the struct itself. For example, this struct will accept the flags named simply `-host` and `-port`.
177+
To help with organization, struct fields can be flattened by setting the tag `flatten:"true"`. As such, the resolved flag name does not include the name of the struct itself. For example, this struct will accept the flags named simply `-host` and `-port` at the same level as `-name`.
178178
179179
type struct Config {
180+
Name string
180181
NetworkConfig struct {
181182
Host string
182183
Port int
183-
}
184+
} `flatten:"true"`
184185
}
185186
186187
Environment variable naming and processing can be overridden with the `env:"name"` tag, where

0 commit comments

Comments
 (0)