Skip to content

Commit

Permalink
Merge pull request #190 from ninech/hidden-all-namespaces
Browse files Browse the repository at this point in the history
feat: add hidden --all-namespaces flag
  • Loading branch information
ctrox authored Nov 25, 2024
2 parents c91ba37 + 3f86694 commit 420942b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions get/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
type Cmd struct {
Output output `help:"Configures list output. ${enum}" short:"o" enum:"full,no-header,contexts,yaml,stats" default:"full"`
AllProjects bool `help:"apply the get over all projects." short:"A"`
AllNamespaces bool `help:"apply the get over all namespaces." hidden:""`
Clusters clustersCmd `cmd:"" group:"infrastructure.nine.ch" aliases:"cluster,vcluster" help:"Get Kubernetes Clusters."`
APIServiceAccounts apiServiceAccountsCmd `cmd:"" group:"iam.nine.ch" name:"apiserviceaccounts" aliases:"asa" help:"Get API Service Accounts."`
Projects projectCmd `cmd:"" group:"management.nine.ch" name:"projects" aliases:"proj" help:"Get Projects."`
Expand Down Expand Up @@ -93,6 +94,13 @@ func (cmd *Cmd) list(ctx context.Context, client *api.Client, list runtimeclient
opt(cmd)
}

if cmd.AllNamespaces {
if err := client.List(ctx, list, cmd.opts...); err != nil {
return fmt.Errorf("error when listing across all namespaces: %w", err)
}
return nil
}

// we now need a bit of reflection code from the apimachinery package
// as the ObjectList interface provides no way to get or set the list
// items directly.
Expand Down

0 comments on commit 420942b

Please sign in to comment.