Skip to content

A string argument parser that understands quotes and backslashes

License

Notifications You must be signed in to change notification settings

txgruppi/parseargs-go

Repository files navigation

GoDocCodeshipCodecovGo Report Card

parseargs-go

This is a port of the parserargs.js project to Go.

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

package main import ( "fmt""log""github.com/txgruppi/parseargs-go" ) funcmain(){setInRedis:=`set name "Put your name here"`parsed, err:=parseargs.Parse(setInRedis) iferr!=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

About

A string argument parser that understands quotes and backslashes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published