github.com/maresnic/mr-kong@v1.0.0/global.go (about)

     1  package kong
     2  
     3  import (
     4  	"os"
     5  )
     6  
     7  // Parse constructs a new parser and parses the default command-line.
     8  func Parse(cli interface{}, options ...Option) *Context {
     9  	parser, err := New(cli, options...)
    10  	if err != nil {
    11  		panic(err)
    12  	}
    13  	ctx, err := parser.Parse(os.Args[1:])
    14  	parser.FatalIfErrorf(err)
    15  	return ctx
    16  }