-
Notifications
You must be signed in to change notification settings - Fork 608
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
chore(cli): improve flag help descriptions to show allowed values instead of type names #5067
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ func (s *KustomizationSource) Set(str string) error { | |
cleanSourceKind, ok := utils.ContainsEqualFoldItemString(supportedKustomizationSourceKinds, sourceKind) | ||
if !ok { | ||
return fmt.Errorf("source kind '%s' is not supported, must be one of: %s", | ||
sourceKind, strings.Join(supportedKustomizationSourceKinds, ", ")) | ||
sourceKind, s.Type()) | ||
} | ||
|
||
s.Kind = cleanSourceKind | ||
|
@@ -71,13 +71,9 @@ func (s *KustomizationSource) Set(str string) error { | |
} | ||
|
||
func (s *KustomizationSource) Type() string { | ||
return "kustomizationSource" | ||
return strings.Join(supportedKustomizationSourceKinds, "|") | ||
} | ||
|
||
func (s *KustomizationSource) Description() string { | ||
return fmt.Sprintf( | ||
"source that contains the Kubernetes manifests in the format '[<kind>/]<name>.<namespace>', "+ | ||
"where kind must be one of: (%s), if kind is not specified it defaults to GitRepository", | ||
strings.Join(supportedKustomizationSourceKinds, ", "), | ||
) | ||
return "source that contains the Kubernetes manifests in the format '[<kind>/]<name>.<namespace>', if kind is not specified it defaults to GitRepository" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reasoning as for chart source. Something like
seems like an improvement to me. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ func (s *LocalHelmChartSource) Set(str string) error { | |
cleanSourceKind, ok := utils.ContainsEqualFoldItemString(supportedHelmChartSourceKinds, sourceKind) | ||
if !ok { | ||
return fmt.Errorf("source kind '%s' is not supported, must be one of: %s", | ||
sourceKind, strings.Join(supportedHelmChartSourceKinds, ", ")) | ||
sourceKind, s.Type()) | ||
} | ||
|
||
s.Kind = cleanSourceKind | ||
|
@@ -58,13 +58,9 @@ func (s *LocalHelmChartSource) Set(str string) error { | |
} | ||
|
||
func (s *LocalHelmChartSource) Type() string { | ||
return "helmChartSource" | ||
return strings.Join(supportedHelmChartSourceKinds, "|") | ||
} | ||
|
||
func (s *LocalHelmChartSource) Description() string { | ||
return fmt.Sprintf( | ||
"source that contains the chart in the format '<kind>/<name>', "+ | ||
"where kind must be one of: (%s)", | ||
strings.Join(supportedHelmChartSourceKinds, ", "), | ||
) | ||
return "source that contains the chart in the format '<kind>/<name>'" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as for chart source mentioned above, just without namespace. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At present (not with this change), this looks like
I think the following may be better
I'm afraid that something like
HelmRepository|GitRepository|Bucket/<name>.<namespace>
could become more confusing as it's a mix of all the allowed values and placeholders. It may be better to just provide the template and list the supported kind values in description.We can even leave this out of this change as the values are not fixed. But I still think the new format is relatively better than an undefined
helmChartSource
value.