Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/icholy/flagslice
Go package for reading flags into a slice
https://github.com/icholy/flagslice
Last synced: about 1 month ago
JSON representation
Go package for reading flags into a slice
- Host: GitHub
- URL: https://github.com/icholy/flagslice
- Owner: icholy
- License: mit
- Created: 2020-11-17T17:29:32.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-18T20:01:48.000Z (about 4 years ago)
- Last Synced: 2024-10-03T15:17:07.096Z (about 2 months ago)
- Language: Go
- Homepage:
- Size: 32.2 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flagslice
[![PkgGoDev](https://pkg.go.dev/badge/github.com/icholy/flagslice)](https://pkg.go.dev/github.com/icholy/flagslice)
> This package provides a reflect based solution for reading flags into a slice.
## Supported Types:
* `bool`
* `int`
* `int64`
* `uint`
* `uint64`
* `float64`
* `string`
* `time.Duration`
* anything implementing `flag.Value`## Example
``` go
package mainimport (
"flag"
"fmt""github.com/icholy/flagslice"
)func main() {
var names []string
flagslice.Var(&names, "name", "a name")
flag.Parse()
for _, name := range names {
fmt.Println(name)
}
}
```