Skip to content
Snippets Groups Projects
Commit 49803b6d authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

Update README.md

parent 53490626
No related branches found
No related tags found
No related merge requests found
...@@ -72,7 +72,7 @@ The following tags are supported: ...@@ -72,7 +72,7 @@ The following tags are supported:
The functions are called up with a receiver. The receiver is the The functions are called up with a receiver. The receiver is the
configuration. The function must have the following signature: configuration. The function must have the following signature:
`func (d *Definition) <name> (s *setting[Definition])` `func (d *Definition) <name> (s *xflags.Settings[Definition])`
Let's assume we have the above definition. The Property `Serve` contains Let's assume we have the above definition. The Property `Serve` contains
the command `serve`. Furthermore, the command has the tag `call` with the command `serve`. Furthermore, the command has the tag `call` with
...@@ -87,13 +87,13 @@ The function is called with the receiver `*Definition` ...@@ -87,13 +87,13 @@ The function is called with the receiver `*Definition`
An example for the function `DoServe`: An example for the function `DoServe`:
```go ```go
func (d *Definition) DoServe(_ *setting[Definition]) { func (d *Definition) DoServe(_ *xflags.Settings[Definition]) {
fmt.Printf("Serving on %s:%d", d.Serve.Host, d.Serve.Port) fmt.Printf("Serving on %s:%d", d.Serve.Host, d.Serve.Port)
} }
``` ```
In this example, the function is called with the receiver `*Definition`. In this example, the function is called with the receiver `*Definition`.
The function is called with the setting `*setting[Definition]`. The The function is called with the setting `*xflags.Settings[Definition]`. The
setting is used to get the values of the flags. But in this example, we setting is used to get the values of the flags. But in this example, we
don't need the setting. So we use the underscore `_` to ignore the don't need the setting. So we use the underscore `_` to ignore the
setting. setting.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment