Skip to content
A string argument parser that understands quotes and backslashes
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Updated .gitignore Jan 24, 2017
LICENSE
README.md s/nproc/txgruppi/g Jan 24, 2017
glide.lock Added glide and test.sh Jan 24, 2017
glide.yaml
parser.go Refactored to reduce cyclomatic complexity Feb 24, 2016
parser_test.go
test.sh Added glide and test.sh Jan 24, 2017

README.md

GoDoc Codeship Codecov Go 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"
)

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

You can’t perform that action at this time.