Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 712 Bytes

README.md

File metadata and controls

33 lines (25 loc) · 712 Bytes

antargs

An argument package for go.

This is a work in progress. Not usable at the moment.

Basic usage:

// setup
antArg, _ := New("myTestProgram", "myTestProgram is a very nice program!")
antArg.NewArg("--say", "What should I say?", false, "", 1)
antArg.NewArg("--style", "In what style should I say it?", false, "", 1)

// parse
antArg.Parse(os.Args)

// use
sayArg := antArg.findArgument("--say")
sayValue := arg.values[0]
styleValue := antArg.findArgument("--style").values[0]

if styleValue == "shout" {
    sayValue = ToUpper(sayValue)
}
fmt.Printf("I say: %s", sayValue)

terminal:

$ ./myTestProgram --say "You're A Wizard, Harry!" --style shout
$ I say: YOU'RE A WIZARD, HARRY!