Add format flag to report generate command#249
Merged
dimityrmirchev merged 3 commits intogardener:mainfrom Jun 11, 2024
Merged
Conversation
|
|
||
| func addReportGenerateFlags(cmd *cobra.Command, opts *generateOptions) { | ||
| cmd.PersistentFlags().Var(cliflag.NewMapStringString(&opts.distinctBy), "distinct-by", "If set generates a merged report. The keys are the IDs for the providers which the merged report will include and the values are distinct metadata attributes to be used as IDs for the different reports.") | ||
| cmd.PersistentFlags().StringVar(&opts.format, "format", "html", "Format for the merged report, dependent on 'distinct-by' flag to be set to take effect. Format can be 'html' or 'json'. Defaults to 'html'.") |
Member
There was a problem hiding this comment.
Cant we always have this flag taking an effect? If value is set to json without "--distinct-by" then we just write the report in json format. It does not make much sense to perform this operation, but it consistent. I do not like having the two flags that tightly connected.
Member
Author
There was a problem hiding this comment.
For consistency we can add this option where when --format=json is set, but --distinct-by is not set we simply output the same json report as the input. I will now add it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Release note: