github.com/kulinacs/cliarg

A simple command line marshal


License
ISC
Install
go get github.com/kulinacs/cliarg

Documentation

Cliarg

Build Status Coverage Status Go Report Card GoDoc

A simple way to store and modify command line executions.

Using

Using cliarg is as simple as adding struct tags. Values are marshalled in order.

Example Struct

type ExampleCliarg struct {
	Arg         string `cliarg:"arg"` // The arg tag places the value of the field in the command line
	Option      string `cliarg:"-o"`  // An option tag places the tag on the command line, followed by the value of the field
	Flag        bool   `cliarg:"-f"`  // A flag tag either places the flag in the command line or not, based on the value of field, occurs if boolean
}

In Use

ExampleCliarg{"/bin/arg", "option", true}

Results

/bin/arg -o option -f