Skip to content

Commit

Permalink
CLI: Fix remote completions (#14712)
Browse files Browse the repository at this point in the history
This PR fixes the logic in `cmpRemotes` to ensure remotes are
contextually completed correctly based on the current remote. While
testing canonical/lxd-pkg-snap#674, I noticed
that the `local` remote was not completed while on a different remote.
  • Loading branch information
tomponline authored Dec 20, 2024
2 parents 5fbd3a7 + 5e7a526 commit ff4e629
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lxc/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ func (g *cmdGlobal) cmpRemotes(includeAll bool) ([]string, cobra.ShellCompDirect
results := make([]string, 0, len(g.conf.Remotes))

for remoteName, rc := range g.conf.Remotes {
if remoteName == "local" || (!includeAll && rc.Protocol != "lxd" && rc.Protocol != "") {
if remoteName == "local" && g.conf.DefaultRemote == "local" || remoteName == g.conf.DefaultRemote || (!includeAll && rc.Protocol != "lxd" && rc.Protocol != "") {
continue
}

Expand Down

0 comments on commit ff4e629

Please sign in to comment.