From 2fa048b2a80a555a30e5866c7d1e0d2e086f068c Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Thu, 6 Jun 2024 14:44:19 +0800 Subject: [PATCH] feat: add --github-badge flag to core options (#502) ## What type of PR is this? /kind feature ## What this PR does / why we need it: Add `--github-badge` flag to core options. ## Which issue(s) this PR fixes: Prepare for #501 --- cmd/app/options/core_options.go | 3 +++ pkg/kubernetes/registry/types.go | 1 + 2 files changed, 4 insertions(+) diff --git a/cmd/app/options/core_options.go b/cmd/app/options/core_options.go index a63eaad9..565a1232 100644 --- a/cmd/app/options/core_options.go +++ b/cmd/app/options/core_options.go @@ -21,6 +21,7 @@ import ( type CoreOptions struct { ReadOnlyMode bool + GithubBadge bool } func NewCoreOptions() *CoreOptions { @@ -33,6 +34,7 @@ func (o *CoreOptions) Validate() []error { func (o *CoreOptions) ApplyTo(config *registry.ExtraConfig) error { config.ReadOnlyMode = o.ReadOnlyMode + config.GithubBadge = o.GithubBadge return nil } @@ -43,4 +45,5 @@ func (o *CoreOptions) AddFlags(fs *pflag.FlagSet) { } fs.BoolVar(&o.ReadOnlyMode, "read-only-mode", false, "turn on the read only mode") + fs.BoolVar(&o.GithubBadge, "github-badge", false, "whether to display the github badge") } diff --git a/pkg/kubernetes/registry/types.go b/pkg/kubernetes/registry/types.go index 98096afa..688269a0 100644 --- a/pkg/kubernetes/registry/types.go +++ b/pkg/kubernetes/registry/types.go @@ -36,4 +36,5 @@ type ExtraConfig struct { ElasticSearchUsername string ElasticSearchPassword string ReadOnlyMode bool + GithubBadge bool }