-
Notifications
You must be signed in to change notification settings - Fork 903
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
(#2591) Add headers to limit output commands #2856
base: develop
Are you sure you want to change the base?
Conversation
The tests added here failed on the pin output with a header due to it being overloaded I think... It might require some further investigation, and perhaps we should do that before merging this in? For completeness this is the Test Kitchen output:
|
src/chocolatey/StringResources.cs
Outdated
|
||
public static class Options | ||
{ | ||
public const string DISPLAY_HEADERS = "display-headers|use-headers"; |
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.
Lets not use aliases at all if we don't need to. Let's use --use-headers
.
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.
Would out[put]-headers
/ add-headers
/ display-headers
be more accurate than use
? Using the headers is something code further along the theoretical pipeline will do, not Choco (to me, at least).
Or just --headers
? Skip verb debate 😅
Converting this back to draft as it requires quite a bit of rework and validation. |
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 I may have taken this for a quick spin, and rebased on the head of the develop branch. Just wanted to give you a heads up, so that you weren't surprised. |
Description Of Changes
When a user asks for limited output from Chocolatey, it is not uncommon to pipe that output to
ConvertFrom-String
orConvertFrom-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.Adds a new feature that allows the user to always display the headers if desired. This defaults to off so that we don't break any existing scripts.
Motivation and Context
Reduce the amount of work end users need to do in order to consume limited output.
Testing
Ran through the tests in the Vagrant test environment. This resulted in two failures that appear unrelated to my changes. I will investigate those further before marking this PR as ready.
NOTE: This will require Chocolatey Licensed Extension changes.
Change Types Made
Related Issue
Fixes #2591
Change Checklist