Skip to content

Commit e18be91

Browse files
author
mritd
committed
fix(config): fix config load error when config path is abs
fix config load error when config path is abs Signed-off-by: mritd <[email protected]>
1 parent 626e5a1 commit e18be91

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/root.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ func initConfig() {
102102
if !ok {
103103
utils.Exit(fmt.Sprintf("could not found current context: %s\n", contextUse), 1)
104104
}
105-
ctxConfig := filepath.Join(cfgDir, ctx.ConfigPath)
105+
106+
var ctxConfig string
107+
if filepath.IsAbs(ctx.ConfigPath) {
108+
ctxConfig = ctx.ConfigPath
109+
} else {
110+
ctxConfig = filepath.Join(cfgDir, ctx.ConfigPath)
111+
}
106112
if _, err = os.Stat(ctxConfig); err != nil {
107113
utils.Exit(fmt.Sprintf("current context [%s] config file %s not found\n", contextUse, ctx.ConfigPath), 1)
108114
}

0 commit comments

Comments
 (0)