Closed mboersma closed 10 years ago
@kbatten, do you have any feedback on this PR? I can't really move forward on my TDD client project without this, unless I'm working off my own fork.
Closing this PR in favor of https://github.com/docopt/docopt.go/pull/9.
The docopt.go API is the simple
Parse()
function. But on bad input or an implied usage request,Parse()
callsos.Exit()
. For library-type code, that is bad form in Go. In practice, it makes it impossible to write tests for a command-line tool using docopt, since there is no way to trapos.Exit()
, and there is no alternate docopt.go API toParse()
.This pull request exports the
parse()
implementation function by renaming it toParseSafe()
. No existing uses ofParse()
will break, and those who need to avoidos.Exit()
or write tests can callParseSafe()
instead.Fixes #7.