1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-19 18:05:32 +08:00

bugfix: get to root cmd for config flag

This commit is contained in:
Juan Batiz-Benet
2014-10-02 03:05:01 -07:00
parent 7bf7afb7a9
commit 068c0375f9

View File

@ -149,7 +149,11 @@ type cmdContext struct {
// setupCmdContext initializes a cmdContext structure from a given command.
func setupCmdContext(c *commander.Command, online bool) (cc cmdContext, err error) {
cc.configDir, err = getConfigDir(c.Parent.Parent)
rootCmd := c
for ; rootCmd.Parent != nil; rootCmd = c.Parent {
}
cc.configDir, err = getConfigDir(rootCmd)
if err != nil {
return
}