Skip to content

Commit f5bbc55

Browse files
committed
refactor extensions handling
1 parent 02f8127 commit f5bbc55

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

internal/cmd/alpha/alpha.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func NewAlphaCMD() *cobra.Command {
4343
"registry_config": config.NewConfigCMD,
4444
"registry_image-import": imageimport.NewImportCMD,
4545
"function_init": function.NewInitCmd,
46-
}, cmd, kymaConfig)
46+
}, cmd)
4747

4848
kymaConfig.DisplayExtensionsErrors(cmd.ErrOrStderr())
4949

internal/cmdcommon/extension.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ func newExtensionsConfig(config *KymaConfig) *KymaExtensionsConfig {
3232

3333
if getBoolFlagValue("--skip-extensions") {
3434
// skip extensions fetching
35-
return &KymaExtensionsConfig{
36-
kymaConfig: config,
37-
}
35+
return extensionsConfig
3836
}
3937

4038
extensionsConfig.extensions, extensionsConfig.parseErrors = loadExtensionsFromCluster(config.Ctx, config.KubeClientConfig)
@@ -52,10 +50,15 @@ func (kec *KymaExtensionsConfig) GetRawExtensions() ExtensionList {
5250
return kec.extensions
5351
}
5452

55-
func (kec *KymaExtensionsConfig) BuildExtensions(availableTemplateCommands *TemplateCommandsList, availableCoreCommands CoreCommandsMap, cmd *cobra.Command, config *KymaConfig) []*cobra.Command {
53+
func (kec *KymaExtensionsConfig) BuildExtensions(availableTemplateCommands *TemplateCommandsList, availableCoreCommands CoreCommandsMap, cmd *cobra.Command) []*cobra.Command {
5654
var cmds []*cobra.Command
5755

58-
var cms, cmsError = getExtensionConfigMaps(config.Ctx, config.KubeClientConfig)
56+
if getBoolFlagValue("--skip-extensions") {
57+
// skip extensions fetching
58+
return nil
59+
}
60+
61+
var cms, cmsError = getExtensionConfigMaps(kec.kymaConfig.Ctx, kec.kymaConfig.KubeClientConfig)
5962
if cmsError != nil {
6063
kec.parseErrors = cmsError
6164
return nil

0 commit comments

Comments
 (0)