Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hodgiwabi
Copy link
Contributor

  • 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

* 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 <toby.hodges@autodesk.com>
@cmoulliard
Copy link
Contributor

Don't forget to update the README.md page and enhance the test cases ;-)

Copy link
Contributor

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:

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)
}
}

Comment on lines +21 to +22
Category string `json:"category"`
PackageType string `json:"packageType"`
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants