-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add get packages
sub-command
#303
Conversation
* Unify `get` command output formatting * yaml-consistent three-dash start of file enables output yaml parsing * lowercase keys * key: value spacing for secrets.data and packages.spec.credentials + Add packages output template * Common go:embed moved to root.go file Signed-off-by: Toby Hodges <[email protected]>
6d07e94
to
9f91e01
Compare
Don't forget to update the README.md page and enhance the test cases ;-) |
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.
Thanks for working on this. This template file is not meant to be YAML parseable though. I know it looks like one but it's meant for humans to read the outputs easily. We have a yaml output option for yaml parsing purposes:
idpbuilder/pkg/cmd/get/secrets.go
Lines 179 to 198 in e8e2319
func printOutput(templatePath string, outWriter io.Writer, data []any, format string) error { | |
switch format { | |
case "json": | |
enc := json.NewEncoder(outWriter) | |
enc.SetEscapeHTML(false) | |
enc.SetIndent("", " ") | |
return enc.Encode(data) | |
case "yaml": | |
b, err := yaml.Marshal(data) | |
if err != nil { | |
return err | |
} | |
_, err = outWriter.Write(b) | |
return err | |
case "": | |
return renderTemplate(templatePath, outWriter, data) | |
default: | |
return fmt.Errorf("output format %s is not supported", format) | |
} | |
} |
Category string `json:"category"` | ||
PackageType string `json:"packageType"` |
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.
I honestly do not know if we can get this kind of data right now.
Closing this due to inactivity. Feel free to reopen. |
get
command output formatting