Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/txgruppi/parseargs-go
A string argument parser that understands quotes and backslashes
https://github.com/txgruppi/parseargs-go
Last synced: about 1 month 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 (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-24T21:54:06.000Z (almost 8 years ago)
- Last Synced: 2024-04-22T22:16:09.353Z (8 months ago)
- Language: Go
- Size: 13.7 KB
- Stars: 10
- Watchers: 1
- 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
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/txgruppi/parseargs-go)
[![Codeship](https://img.shields.io/codeship/173b62f0-bcc9-0133-0239-6e8926ac3d5c/master.svg?style=flat-square)](https://codeship.com/projects/136367)
[![Codecov](https://img.shields.io/codecov/c/github/txgruppi/parseargs-go/master.svg?style=flat-square)](https://codecov.io/github/txgruppi/parseargs-go)
[![Go Report Card](https://img.shields.io/badge/go_report-A+-brightgreen.svg?style=flat-square)](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