File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -133,8 +133,8 @@ func main() {
133
133
```
134
134
135
135
That code generates next output:
136
- ```
137
- go run ./main.go --help
136
+ ``` sh
137
+ $ go run ./main.go --help
138
138
Usage of _obj/exe/main:
139
139
-http-host value
140
140
HTTP host (default 127.0.0.1)
@@ -151,7 +151,7 @@ exit status 2
151
151
152
152
The flag default key string is the struct field name but can be specified in the struct field's tag value.
153
153
The "flag" key in the struct field's tag value is the key name, followed by an optional comma and options. Examples:
154
- ```
154
+ ``` golang
155
155
// Field is ignored by this package.
156
156
Field int ` flag:"-"`
157
157
@@ -175,9 +175,9 @@ Field int `flag:",deprecated"`
175
175
## Options for desc tag
176
176
If you specify description in description tag (` desc ` by default) it will be used in USAGE section.
177
177
178
- ```
178
+ ``` golang
179
179
Addr string ` desc:"HTTP host"`
180
- ```
180
+ ` ` ` sh
181
181
this description produces something like:
182
182
` ` `
183
183
-addr value
@@ -189,7 +189,7 @@ this description produces something like:
189
189
190
190
## Options for Parse function:
191
191
192
- ```
192
+ ``` golang
193
193
// DescTag sets custom description tag. It is "desc" by default.
194
194
func DescTag (val string )
195
195
@@ -226,3 +226,4 @@ func Flatten(val bool)
226
226
227
227
* https:// github.com/jaffee/commandeer
228
228
* https:// github.com/anacrolix/tagflag
229
+ * https:// github.com/jessevdk/go-flags
You can’t perform that action at this time.
0 commit comments