Commit 5c26a53 mritd
committed
1 parent fd24720 commit 5c26a53 Copy full SHA for 5c26a53
File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ func initConfig() {
66
66
}
67
67
68
68
// get current use context
69
- ctx , ok := mmh .Main . Contexts . FindContextByName (mmh .Main .Current )
69
+ ctx , ok := mmh .FindContextByName (mmh .Main .Current )
70
70
if ! ok {
71
71
utils .Exit (fmt .Sprintf ("could not found current context: %s\n " , mmh .Main .Current ), 1 )
72
72
}
@@ -87,7 +87,7 @@ func initConfig() {
87
87
utils .CheckAndExit (mmh .CurrentContext .LoadFrom (ctxConfigFile ))
88
88
89
89
// get current use context
90
- basicCtx , ok := mmh .Main . Contexts . FindContextByName (mmh .Main .Basic )
90
+ basicCtx , ok := mmh .FindContextByName (mmh .Main .Basic )
91
91
if ok {
92
92
if filepath .IsAbs (basicCtx .ConfigPath ) {
93
93
ctxConfigFile = basicCtx .ConfigPath
Original file line number Diff line number Diff line change 35
35
)
36
36
37
37
// find context by name
38
- func ( cs Contexts ) FindContextByName (name string ) (Context , bool ) {
39
- for _ , ctx := range cs {
38
+ func FindContextByName (name string ) (Context , bool ) {
39
+ for _ , ctx := range Main . Contexts {
40
40
if name == ctx .Name {
41
41
return ctx , true
42
42
}
@@ -406,7 +406,7 @@ func ListContexts() {
406
406
407
407
// set current context
408
408
func UseContext (ctxName string ) {
409
- _ , ok := Main . Contexts . FindContextByName (ctxName )
409
+ _ , ok := FindContextByName (ctxName )
410
410
if ! ok {
411
411
utils .Exit (fmt .Sprintf ("context [%s] not found" , ctxName ), 1 )
412
412
}
You can’t perform that action at this time.
0 commit comments