Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enh/target cluster by alias #185

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
enh: autocompletion/suggestion also lists aliases
  • Loading branch information
sven-petersen committed Dec 12, 2022
commit ca5d78b5117fb83219d24f4f9c15d764ae293b0c
8 changes: 6 additions & 2 deletions pkg/target/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type FlagCompletors interface {
// ProjectNames returns all projects for the currently targeted garden.
// The current target must at least point to a garden.
ProjectNames(ctx context.Context) ([]string, error)
// GardenNames returns all names of configured Gardens.
// GardenNames returns all identities and aliases of configured Gardens.
GardenNames() ([]string, error)
}

Expand Down Expand Up @@ -737,7 +737,7 @@ func (m *managerImpl) ProjectNames(ctx context.Context) ([]string, error) {
return names.List(), nil
}

// GardenNames returns all names of configured Gardens.
// GardenNames returns all identities and aliases of configured Gardens.
func (m *managerImpl) GardenNames() ([]string, error) {
config := m.Configuration()
if config == nil {
Expand All @@ -747,6 +747,10 @@ func (m *managerImpl) GardenNames() ([]string, error) {
names := sets.NewString()
for _, garden := range config.Gardens {
names.Insert(garden.Name)

if garden.Alias != "" {
names.Insert(garden.Alias)
}
}

return names.List(), nil
Expand Down