Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 818 Bytes

README.md

File metadata and controls

47 lines (32 loc) · 818 Bytes

argparser

An opinionated argument parser for Go.

Table Of Contents

Usage

This package allows for understanding the following command line arguments format. command [arguments] [parameters] i.e.: command do --something

Import the package into your project.

import "github.com/eloonstra/argparser"

Grab the arguments from the command line.

args := argparser.Parse()

Now you can check whether an argument is present.

if args.HasArg("foo") {
    // do something
}

You can also check for parameters (including finding out their value) as follows.

if args.HasParam("foo") {
    value, err := args.GetParamValue("foo")
    // do something
}

That's it! All the other stuff is handled for you.

License

MIT