Skip to content

Commit

Permalink
lxc/completion: Fix cmpInstanceSetKeys to return set instance confi…
Browse files Browse the repository at this point in the history
…g keys

Signed-off-by: Kadin Sayani <[email protected]>
  • Loading branch information
kadinsayani committed Dec 19, 2024
1 parent 138141b commit 4307f76
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lxc/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,6 @@ func (g *cmdGlobal) cmpInstanceSetKeys(instanceName string) ([]string, cobra.She
return nil, cobra.ShellCompDirectiveError
}

instanceType := instance.Type

// Fetch all config keys that can be set by a user based on instance type.
allInstanceConfigKeys, _ := g.cmpInstanceKeys(instanceName)

Expand All @@ -378,11 +376,7 @@ func (g *cmdGlobal) cmpInstanceSetKeys(instanceName string) ([]string, cobra.She
// We only want to return the intersection between allInstanceConfigKeys and configKeys to avoid returning the full instance config.
_, exists := keySet[configKey]
if exists {
if shared.StringHasPrefix(configKey, instancetype.ConfigKeyPrefixesAny...) {
configKeys = append(configKeys, configKey)
} else if instanceType == string(api.InstanceTypeContainer) && shared.StringHasPrefix(configKey, instancetype.ConfigKeyPrefixesContainer...) {
configKeys = append(configKeys, configKey)
}
configKeys = append(configKeys, configKey)
}
}

Expand Down

0 comments on commit 4307f76

Please sign in to comment.