Kong tag PR fixes (#12)
* Removed bubbling errors in favour of panic * Added a test for Parse with a bad build and an arg. * Removed is() function in favour of a switch with strings * Collect key and value in parseCSV, reducing complexity. * Fix in global to not use parser instance on error.
This commit is contained in:
committed by
Alec Thomas
parent
31e1ffaa3b
commit
ecd369e622
@@ -51,6 +51,7 @@ func New(ast interface{}, options ...Option) (*Kong, error) {
|
||||
for _, option := range options {
|
||||
option(k)
|
||||
}
|
||||
|
||||
return k, nil
|
||||
}
|
||||
|
||||
@@ -75,11 +76,7 @@ func (k *Kong) Parse(args []string) (command string, err error) {
|
||||
}
|
||||
|
||||
func (k *Kong) Errorf(format string, args ...interface{}) {
|
||||
if k.Model != nil {
|
||||
fmt.Fprintf(os.Stderr, k.Model.Name+": "+format, args...)
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, format, args...)
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, k.Model.Name+": "+format, args...)
|
||||
}
|
||||
|
||||
func (k *Kong) FatalIfErrorf(err error, args ...interface{}) {
|
||||
|
||||
Reference in New Issue
Block a user