You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
A new OutputHelpers class has been introduced in an attempt to simplify
the concatenation of the limited output, when a collection of strings
are joined to the "|" character.
Some new Pester tests have also been added to verify the output from the
commands, both when the new '--include-headers' option is used, as well
as the 'alwaysIncludeHeaders' feature.
Copy file name to clipboardExpand all lines: src/chocolatey/StringResources.cs
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -655,5 +655,15 @@ public static class ErrorMessages
655
655
internalconststringUnableToDowngrade="A newer version of {0} (v{1}) is already installed.{2} Use --allow-downgrade or --force to attempt to install older versions.";
656
656
internalconststringDependencyFailedToInstall="Failed to install {0} because a previous dependency failed.";
657
657
}
658
+
659
+
publicstaticclassOptionDescriptions
660
+
{
661
+
publicconststringIncludeHeaders="Include header names when --limit-output is used. Requires Chocolatey CLI 2.5.0+";
config.Features.UsePackageRepositoryOptimizations=SetFeatureFlag(ApplicationParameters.Features.UsePackageRepositoryOptimizations,configFileSettings,defaultEnabled:true,description:"Use Package Repository Optimizations - Turn on optimizations for reducing bandwidth with repository queries during package install/upgrade/outdated operations. Should generally be left enabled, unless a repository needs to support older methods of query. When disabled, this makes queries similar to the way they were done in earlier versions of Chocolatey.");
342
342
config.Features.UsePackageHashValidation=SetFeatureFlag(ApplicationParameters.Features.UsePackageHashValidation,configFileSettings,defaultEnabled:false,description:"Use Package Hash Validation - Check the hash of the downloaded package file against the source provided hash. Only supports sources that provide SHA512 hashes. Disabled by default. Available in 2.3.0+");
343
343
config.PromptForConfirmation=!SetFeatureFlag(ApplicationParameters.Features.AllowGlobalConfirmation,configFileSettings,defaultEnabled:false,description:"Prompt for confirmation in scripts or bypass.");
344
-
config.DisableCompatibilityChecks=SetFeatureFlag(ApplicationParameters.Features.DisableCompatibilityChecks,configFileSettings,defaultEnabled:false,description:"Disable Compatibility Checks - Disable showing a warning when there is an incompatibility between Chocolatey CLI and Chocolatey Licensed Extension.");
344
+
config.DisableCompatibilityChecks=SetFeatureFlag(ApplicationParameters.Features.DisableCompatibilityChecks,configFileSettings,defaultEnabled:false,description:"Disable Compatibility Checks - Disable showing a warning when there is an incompatibility between Chocolatey CLI and Chocolatey Licensed Extension. Available in 1.1.0+");
"CommandExecutionTimeout (in seconds) - The time to allow a command to finish before timing out. Overrides the default execution timeout in the configuration of {0} seconds. Supply '0' to disable the timeout.".FormatWith(config.CommandExecutionTimeoutSeconds.ToStringSafe()),
"Proxy Bypass On Local - Bypass proxy for local connections. Requires explicit proxy (`--proxy` or config setting). Overrides the default proxy bypass on local setting of '{0}'.".FormatWith(config.Proxy.BypassOnLocal),
455
459
option =>config.Proxy.BypassOnLocal=option!=null)
456
-
.Add("log-file=",
460
+
.Add("log-file=",
457
461
"Log File to output to in addition to regular loggers.",
0 commit comments