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 a header row to --limit-output output #2591

Open
corbob opened this issue Feb 8, 2022 · 1 comment · May be fixed by #2856
Open

Add a header row to --limit-output output #2591

corbob opened this issue Feb 8, 2022 · 1 comment · May be fixed by #2856

Comments

@corbob
Copy link
Member

corbob commented Feb 8, 2022

When you use --limit-output or -r you can pipe the output to ConvertFrom-Csv and provide -Delimiter '|' to get a PowerShell object. In order to get a proper one, you need to also pass in -Header. It would be beneficial to output a header row for the user so they don't need this.

The output I envision for choco list -lo -r would change from:

chocolatey|0.12.1

to (something like):

PackageId|Version
chocolatey|0.12.1`

In order to make this change in a way to not break existing scripts/workflows, I would suggest adding a feature showHeaderOnLimitOutput that defaults to disabled with the possibility of defaulting it to enabled in a future version.

@corbob
Copy link
Member Author

corbob commented Oct 13, 2022

I've got some working code on this, I just need to add some tests then I'll put up a PR for this one.

corbob added a commit to corbob/choco that referenced this issue Oct 13, 2022
When a user asks for limited output from Chocolatey, it is not uncommon
to pipe that output to `ConvertFrom-String` or `ConvertFrom-Csv` and
manually add headers to get back an object. This allows for getting a
header row back so that the end user doesn't need to add their own
headers and discern what they are.

This also adds a StringResources static class that allows us to store
constant strings in and use them across the code to reduce duplication.
@corbob corbob linked a pull request Oct 13, 2022 that will close this issue
9 tasks
corbob added a commit to corbob/choco that referenced this issue Oct 13, 2022
When a user asks for limited output from Chocolatey, it is not uncommon
to pipe that output to `ConvertFrom-String` or `ConvertFrom-Csv` and
manually add headers to get back an object. This allows for getting a
header row back so that the end user doesn't need to add their own
headers and discern what they are.

This also adds a StringResources static class that allows us to store
constant strings in and use them across the code to reduce duplication.
@gep13 gep13 added this to the 2.0.0 milestone Jan 19, 2023
@pauby pauby changed the title add a header row to --limit-output output Add a header row to --limit-output output Mar 16, 2023
@pauby pauby modified the milestones: 2.0.0, 2.1.0 Mar 16, 2023
@gep13 gep13 modified the milestones: 2.1.0, vNext Jun 5, 2023
corbob added a commit to corbob/choco that referenced this issue Mar 6, 2024
When a user asks for limited output from Chocolatey, it is not uncommon
to pipe that output to `ConvertFrom-String` or `ConvertFrom-Csv` and
manually add headers to get back an object. This allows for getting a
header row back so that the end user doesn't need to add their own
headers and discern what they are.

This also adds a StringResources static class that allows us to store
constant strings in and use them across the code to reduce duplication.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants