Implement a robust Context.Run().

This helps when composing large applications from separate command
structs.
This commit is contained in:
Alec Thomas
2018-06-21 21:50:30 +10:00
parent e4f37b5d1a
commit a2ec050947
16 changed files with 727 additions and 279 deletions
+2 -2
View File
@@ -14,9 +14,9 @@ func Parse(cli interface{}, options ...Option) string {
panic(err)
}
App = parser
cmd, err := parser.Parse(os.Args[1:])
ctx, err := parser.Parse(os.Args[1:])
parser.FatalIfErrorf(err)
return cmd
return ctx.Command()
}
// FatalIfErrorf terminates with an error message if err != nil.