Use variadic options to configure Kong.

This commit is contained in:
Alec Thomas
2018-05-18 21:17:48 +10:00
parent b4b5827044
commit d03571a873
5 changed files with 128 additions and 18 deletions
+3 -2
View File
@@ -2,8 +2,9 @@ package kong
import "os"
func Parse(cli interface{}) {
parser, err := New("", "", cli)
// Parse constructs a new parser and parses the default command-line.
func Parse(cli interface{}, options ...Option) {
parser, err := New(cli, options...)
parser.FatalIfErrorf(err)
_, err = parser.Parse(os.Args[1:])
parser.FatalIfErrorf(err)