https://github.com/txgruppi/parseargs-go
A string argument parser that understands quotes and backslashes
https://github.com/txgruppi/parseargs-go
Last synced: 17 days ago
JSON representation
A string argument parser that understands quotes and backslashes
- Host: GitHub
- URL: https://github.com/txgruppi/parseargs-go
- Owner: txgruppi
- License: mit
- Created: 2016-02-24T00:53:38.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-24T21:54:06.000Z (over 8 years ago)
- Last Synced: 2025-04-06T05:37:07.316Z (27 days ago)
- Language: Go
- Size: 13.7 KB
- Stars: 10
- Watchers: 0
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go-extra - parseargs-go - 02-24T00:53:38Z|2017-01-24T21:54:06Z| (Bot Building / Parsers/Encoders/Decoders)
README
[](https://godoc.org/github.com/txgruppi/parseargs-go)
[](https://codeship.com/projects/136367)
[](https://codecov.io/github/txgruppi/parseargs-go)
[](https://goreportcard.com/report/github.com/txgruppi/parseargs-go)# `parseargs-go`
This is a port of the [parserargs.js](https://github.com/txgruppi/parseargs.js) project to [Go](https://golang.org).
What about parsing arguments allowing quotes in them? But beware that this library will not parse flags (-- and -), flags will be returned as simple strings.
## Installation
`go get -u github.com/txgruppi/parseargs-go`
## Example
```go
package mainimport (
"fmt"
"log""github.com/txgruppi/parseargs-go"
)func main() {
setInRedis := `set name "Put your name here"`
parsed, err := parseargs.Parse(setInRedis)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", parsed) // []string{"set", "name", "Put your name here"}
}
```## Tests
```
go get -u -t github.com/txgruppi/parseargs-go
cd $GOPATH/src/github.com/txgruppi/parseargs-go
go test ./...
```## License
MIT