This fixes a regression introduced by #227. When looking up global flags by walking up the parent context's we need to consider the special case when we are starting at the very top and there is no parent context to start the traversal.
Fixes#252
This change allows a context value to be set after parsing. The use case is updating default settings in a Before func.
An example usage:
```
f, err := os.Open(configPath)
if err == nil {
config, err := docli.NewConfig(f)
if err != nil {
panic(err)
}
c.Set("token", config.APIKey)
}
```
The usecase:
my-cli user <USERID> set <FIELD> <VALUE>
Being able to swap <USERID> with set argument, we can have nested subcommands while preserving all variable arguments along the way.
Compared to BoolFlag type, BoolTFlag treats 'true' as the default value
for the flag.
Without it, we have to use --no-action flag if we set the action is done
in default. But sometimes it is bad to maintain flags with negative meanings.
And it will be painful if we change the default value for the flag.
As this implementation, it keeps all existing functionality. So it
is compatible with old versions.
The following warnings were being displayed when the package was installed/used:
/usr/lib/go/src/pkg/github.com/codegangsta/cli/context.go:56: function ends without a return statement
/usr/lib/go/src/pkg/github.com/codegangsta/cli/context.go:69: function ends without a return statement
/usr/lib/go/src/pkg/github.com/codegangsta/cli/context.go:78: function ends without a return statement