Make Command accessible from Context

This commit is contained in:
Chris Winslett
2014-03-29 12:02:05 -07:00
parent 3fa24ca4f3
commit c69522c960
3 changed files with 6 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ import (
// parsed command-line options.
type Context struct {
App *App
Command Command
flagSet *flag.FlagSet
globalSet *flag.FlagSet
setFlags map[string]bool
@@ -20,7 +21,7 @@ type Context struct {
// Creates a new context. For use in when invoking an App or Command action.
func NewContext(app *App, set *flag.FlagSet, globalSet *flag.FlagSet) *Context {
return &Context{app, set, globalSet, nil}
return &Context{App: app, flagSet: set, globalSet: globalSet}
}
// Looks up the value of a local int flag, returns 0 if no int flag exists