Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xflags
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Libraries
Go
Application
xflags
Commits
b96b4adf
Verified
Commit
b96b4adf
authored
2 years ago
by
Volker Schukai
Browse files
Options
Downloads
Patches
Plain Diff
doc: shadow described
parent
ff3b458b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+25
-1
25 additions, 1 deletion
README.md
with
25 additions
and
1 deletion
README.md
+
25
−
1
View file @
b96b4adf
...
...
@@ -65,9 +65,9 @@ The following tags are supported:
|
`required`
| Value | Flag is required. |
|
`command`
| Command | Flag is a command. |
|
`call`
| Command | Function to call when the command is used. |
|
`shadow`
| Value | Copy the value to the shadow structure. |
|
`ignore`
| -/- | Property is ignored. |
### Callbacks
The functions are called up with a receiver. The receiver is the
...
...
@@ -143,6 +143,30 @@ The function `Execute()` executes the command. See the section
setting
.
Execute
()
```
### Shadow
The shadow structure is used to copy the values of the flags to the
shadow structure. The shadow structure is set using the
`SetShadow()`
and configured using the tag
`shadow`
.
```
go
type
Shadow
struct
{
Verbose
bool
Serve
struct
{
Host
string
Port
int
}
}
func
main
()
{
setting
:=
New
(
os
.
Args
[
0
],
Definition
{})
setting
.
SetShadow
(
Shadow
{})
setting
.
Parse
(
os
.
Args
[
1
:
])
setting
.
Execute
()
fmt
.
Printf
(
"Shadow: %+v"
,
setting
.
GetShadow
())
}
```
## Contributing
Merge requests are welcome. For major changes, please open an issue first to discuss what
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment