From 17faf61baf54435352dbbed2bb68fcf67a0bcc54 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Wed, 13 Mar 2019 18:47:49 -0500 Subject: [PATCH 01/19] (doc) update older release notes --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9654e1ae56..62f569e0c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -552,10 +552,10 @@ This further restricts the default installation location by removing all permiss * Fix - Chocolatey command help output written to standard error instead of standard out - see [#468](https://github.com/chocolatey/choco/issues/468) * Fix - Logger doesn't clear cached NullLoggers - see [#516](https://github.com/chocolatey/choco/issues/516) * Fix - DISM "/All" argument in the wrong position - see [#480](https://github.com/chocolatey/choco/issues/480) - * Fix - Pro - Installing/uninstalling extensions should rename files in use - see [#594](https://github.com/chocolatey/choco/issues/594) + * Fix - Pro/Business - Installing/uninstalling extensions should rename files in use - see [#594](https://github.com/chocolatey/choco/issues/594) * Fix - Running Get-WebFileName in PowerShell 5 fails and sometimes causes package errors - see [#603](https://github.com/chocolatey/choco/issues/603) * Fix - Merging assemblies on a machine running .Net 4.5 or higher produces binaries incompatible with .Net 4 - see [#392](https://github.com/chocolatey/choco/issues/392) - * Fix - API - Incorrect log4net version in chocolatey.lib dependencies - see [#390](https://github.com/chocolatey/choco/issues/390) + * Fix - [API] - Incorrect log4net version in chocolatey.lib dependencies - see [#390](https://github.com/chocolatey/choco/issues/390) * [POSH Host] Fix - Message after Download progress is on the same line sometimes - see [#525](https://github.com/chocolatey/choco/issues/525) * [POSH Host] Fix - PowerShell internal process - "The handle is invalid." - see [#526](https://github.com/chocolatey/choco/issues/526) * [POSH Host] Fix - The handle is invalid - when output is being redirected and a package attempts to write to a filestream - see [#572](https://github.com/chocolatey/choco/issues/572) From a7868f55c572f5d929552a7c06cf5b71bb25fa25 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Wed, 13 Mar 2019 18:56:35 -0500 Subject: [PATCH 02/19] (doc) update release notes for 0.10.12 release --- CHANGELOG.md | 53 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62f569e0c0..3557dabdae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,14 +3,51 @@ This covers changes for the "chocolatey" and "chocolatey.lib" packages, which ar **NOTE**: If you have a licensed edition of Chocolatey ("chocolatey.extension"), refer to this in tandem with [Chocolatey Licensed CHANGELOG](https://github.com/chocolatey/choco/blob/master/CHANGELOG_LICENSED.md). -## 0.10.12 - (Unreleased) -### Bug Fixes - * Fix - Uninstall-ChocolateyZipPackage - Corrected issue with null passed to Test-Path - see [#1546](https://github.com/chocolatey/choco/issues/1546) and [#1550](https://github.com/chocolatey/choco/issues/1550) - * Fix - Get-ChocolateyWebFile - Setting Security Protocol to SSL3 is not supported with PowerShell 6.0.3 - see [#1623](https://github.com/chocolatey/choco/issues/1623) - -### Improvements - * Performance of `choco outdated` command - see [#1397](https://github.com/chocolatey/choco/issues/1397) - * Added ability to get consistent hash of ConfigFileSettings class - see [#1612](https://github.com/chocolatey/choco/issues/1612) +## [0.10.12](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.12+is%3Aclosed) - (March 14, 2019) +### FEATURES + * Halt install if dependency requires a reboot - see [#1038](https://github.com/chocolatey/choco/issues/1038) + +### BUG FIXES + * [Security] Fix - upgrade - remove automation scripts prior to upgrade even if changed - see [#1689](https://github.com/chocolatey/choco/issues/1689) + * [Security] Fix - scripts - Digitally sign the init.ps1 PowerShell file as well - see [#1665](https://github.com/chocolatey/choco/issues/1665) + * Fix - When a source fails, choco exits instead of moving to next source - see [#612](https://github.com/chocolatey/choco/issues/612) + * Fix - Upgrade all reuses overridden package parameters when useRememberedArgumentsForUpgrades feature is turned on - see [#1443](https://github.com/chocolatey/choco/issues/1443) + * Fix - Passing `--execution-timeout=0` doesn't override the default execution timeout in the configuration - see [#1747](https://github.com/chocolatey/choco/issues/1747) + * Fix - ChocolateyLastPathUpdate environment variable stores date as locale-specific - see [#1604](https://github.com/chocolatey/choco/issues/1604) + * [POSH Host] Fix - install/upgrade/uninstall - PowerShell host should exit with 1 instead of -1 if there is a package error - see [#1734](https://github.com/chocolatey/choco/issues/1734) + * Fix - Logging - warnings for ".registry.bad." files are emitted with "-r" switch - see [#1580](https://github.com/chocolatey/choco/issues/1580) + * Fix - Logging - ".registry.bad" files are created for actually valid registry snapshots - see [#1581](https://github.com/chocolatey/choco/issues/1746) + * Fix - list/search - Listing local packages fails if no sources are enabled - see [#661](https://github.com/chocolatey/choco/issues/661) + * Fix - uninstall - Object reference exception when there are no sources - see [#1584](https://github.com/chocolatey/choco/issues/1584) + * Fix - Logging - self-service errors attempting to write to the config when using Chocolatey GUI - see [#1649](https://github.com/chocolatey/choco/issues/1649) + * Fix - source list - running with -r fails to escape pipe (|) char - see [#1614](https://github.com/chocolatey/choco/issues/1614) + * Fix - source add - Adding a source allows an empty url - see [#1582](https://github.com/chocolatey/choco/issues/1582) + * Fix - Get-ChocolateyWebFile - Ensure PSVersionTable is used for PowerShell Version - see [#1623](https://github.com/chocolatey/choco/issues/1623) + * Fix - Install-ChocolateyShortcut - Don't create a folder if environment variable is used - see [#1687](https://github.com/chocolatey/choco/issues/1687) + * Fix - `choco --version` includes warnings, breaks version parsing - see [#1562](https://github.com/chocolatey/choco/issues/1562) + * Fix - Uninstall-ChocolateyZipPackage failing with Path error - see [#1550](https://github.com/chocolatey/choco/issues/1550) + * Fix - Uninstall-ChocolateyZipPackage fails from null passed to Test-Path - see [#1546](https://github.com/chocolatey/choco/issues/1546) + * Fix - Get-ChocolateyUnzip - Ensure 7z cmd window is hidden - see [#1642](https://github.com/chocolatey/choco/issues/1642) + * [API] Fix - Resolve assemblies globally without locking - see [#1735](https://github.com/chocolatey/choco/issues/1735) + +### IMPROVEMENTS + * [Security] tools - Update 7z to 18.06 Enhancement Security - see [#1704](https://github.com/chocolatey/choco/issues/1704) + * [Security] Refreshenv script leaves temporary file behind - see [#1549](https://github.com/chocolatey/choco/issues/1549) + * Halt install if dependency requires a reboot - see [#1038](https://github.com/chocolatey/choco/issues/1038) + * Logging - better default colors - see [#1131](https://github.com/chocolatey/choco/issues/1131) + * Validate config / system state across everything - see [#1746](https://github.com/chocolatey/choco/issues/1746) + * upgrade - switch for not installing if not installed - see [#1646](https://github.com/chocolatey/choco/issues/1646) + * outdated - improve performance of `choco outdated` - see [#1397](https://github.com/chocolatey/choco/issues/1397) + * outdated - Use exit codes to determine update status - see [#1602](https://github.com/chocolatey/choco/issues/1602) + * search/list/info - exit 1 when no results are returned - see [#1724](https://github.com/chocolatey/choco/issues/1724) + * search/list - Add alias "find" for search - see [#1744](https://github.com/chocolatey/choco/issues/1744) + * apikey - Enable removal of API key via CLI - see [#1301](https://github.com/chocolatey/choco/issues/1301) + * Logging - Choco --log-file option should create log files relative to current directory - see [#1603](https://github.com/chocolatey/choco/issues/1603) + * Logging - Don't suggest installing separate "checksum" tool - see [#981](https://github.com/chocolatey/choco/issues/981) + * template - Add notes to uninstaller file string on how to correctly parse the value from the registry - see [#1644](https://github.com/chocolatey/choco/issues/1644) + * Pro/Business - license - If license is found in top-level folder or named wrong, choco should warn - see [#1503](https://github.com/chocolatey/choco/issues/1503) + * [API] Allow verifying DI Container in release build - see [#1738](https://github.com/chocolatey/choco/issues/1738) + * [API] ability to get consistent hash of ConfigFileSettings class - see [#1612](https://github.com/chocolatey/choco/issues/1612) ## [0.10.11](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.11+is%3Aclosed) (May 4, 2018) From 606e8550e873b1a962e090948ad21c03c44b6b2e Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 15:29:20 -0500 Subject: [PATCH 03/19] (GH-1758) control enhanced exit codes w/feature In #1602 and #1724, enhanced exit codes were added to provide more intentional exit codes that determine the state of what happened during the run. This would allow simply seeing a 0 from outdated and knowing that all packages are up to date, or seeing a 2 and knowing that packages need updated. This allows for better scripting based on exit codes. However, there are some existing integrations that might be broken on taking on a newer version of Chocolatey if the enhanced exit codes are not being looked for yet. To allow compatibility to older systems, add a feature switch that can be disabled to provide the older behavior of 0 or 1 exit codes. --- src/chocolatey/infrastructure.app/ApplicationParameters.cs | 1 + .../infrastructure.app/builders/ConfigurationBuilder.cs | 3 ++- .../infrastructure.app/commands/ChocolateyListCommand.cs | 2 +- .../configuration/ChocolateyConfiguration.cs | 3 ++- .../infrastructure.app/services/ChocolateyPackageService.cs | 3 ++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/chocolatey/infrastructure.app/ApplicationParameters.cs b/src/chocolatey/infrastructure.app/ApplicationParameters.cs index 87f51a308b..75cf0f7dcc 100644 --- a/src/chocolatey/infrastructure.app/ApplicationParameters.cs +++ b/src/chocolatey/infrastructure.app/ApplicationParameters.cs @@ -167,6 +167,7 @@ public static class Features public static readonly string FailOnInvalidOrMissingLicense = "failOnInvalidOrMissingLicense"; public static readonly string IgnoreInvalidOptionsSwitches = "ignoreInvalidOptionsSwitches"; public static readonly string UsePackageExitCodes = "usePackageExitCodes"; + public static readonly string UseEnhancedExitCodes = "useEnhancedExitCodes"; public static readonly string UseFipsCompliantChecksums = "useFipsCompliantChecksums"; public static readonly string ScriptsCheckLastExitCode = "scriptsCheckLastExitCode"; public static readonly string ShowNonElevatedWarnings = "showNonElevatedWarnings"; diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index daff600795..84c373133c 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -291,7 +291,8 @@ private static void set_feature_flags(ChocolateyConfiguration config, ConfigFile config.Features.VirusCheck = set_feature_flag(ApplicationParameters.Features.VirusCheck, configFileSettings, defaultEnabled: false, description: "Virus Check - perform virus checking on downloaded files. Available in 0.9.10+. Licensed versions only."); config.Features.FailOnInvalidOrMissingLicense = set_feature_flag(ApplicationParameters.Features.FailOnInvalidOrMissingLicense, configFileSettings, defaultEnabled: false, description: "Fail On Invalid Or Missing License - allows knowing when a license is expired or not applied to a machine. Available in 0.9.10+."); config.Features.IgnoreInvalidOptionsSwitches = set_feature_flag(ApplicationParameters.Features.IgnoreInvalidOptionsSwitches, configFileSettings, defaultEnabled: true, description: "Ignore Invalid Options/Switches - If a switch or option is passed that is not recognized, should choco fail? Available in 0.9.10+."); - config.Features.UsePackageExitCodes = set_feature_flag(ApplicationParameters.Features.UsePackageExitCodes, configFileSettings, defaultEnabled: true, description: "Use Package Exit Codes - Package scripts can provide exit codes. With this on, package exit codes will be what choco uses for exit when non-zero (this value can come from a dependency package). Chocolatey defines valid exit codes as 0, 1605, 1614, 1641, 3010. With this feature off, choco will exit with a 0 or a 1 (matching previous behavior). Available in 0.9.10+."); + config.Features.UsePackageExitCodes = set_feature_flag(ApplicationParameters.Features.UsePackageExitCodes, configFileSettings, defaultEnabled: true, description: "Use Package Exit Codes - Package scripts can provide exit codes. With this on, package exit codes will be what choco uses for exit when non-zero (this value can come from a dependency package). Chocolatey defines valid exit codes as 0, 1605, 1614, 1641, 3010. With this feature off, choco will exit with 0, 1, or -1 (matching previous behavior). Available in 0.9.10+."); + config.Features.UseEnhancedExitCodes = set_feature_flag(ApplicationParameters.Features.UseEnhancedExitCodes, configFileSettings, defaultEnabled: true, description: "Use Enhanced Exit Codes - Chocolatey is able to provide enhanced exit codes surrounding list, search, info, outdated and other commands that don't deal directly with package operations. To see enhanced exit codes and their meanings, please run `choco [cmdname] -?`. With this feature off, choco will exit with 0, 1, or -1 (matching previous behavior). Available in 0.10.12+."); config.Features.UseFipsCompliantChecksums = set_feature_flag(ApplicationParameters.Features.UseFipsCompliantChecksums, configFileSettings, defaultEnabled: false, description: "Use FIPS Compliant Checksums - Ensure checksumming done by choco uses FIPS compliant algorithms. Not recommended unless required by FIPS Mode. Enabling on an existing installation could have unintended consequences related to upgrades/uninstalls. Available in 0.9.10+."); config.Features.ShowNonElevatedWarnings = set_feature_flag(ApplicationParameters.Features.ShowNonElevatedWarnings, configFileSettings, defaultEnabled: true, description: "Show Non-Elevated Warnings - Display non-elevated warnings. Available in 0.10.4+."); config.Features.ShowDownloadProgress = set_feature_flag(ApplicationParameters.Features.ShowDownloadProgress, configFileSettings, defaultEnabled: true, description: "Show Download Progress - Show download progress percentages in the CLI. Available in 0.10.4+."); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs index e2fd6e2e83..46d49d8aab 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs @@ -205,7 +205,7 @@ public virtual void run(ChocolateyConfiguration configuration) var packageResults = _packageService.list_run(configuration).ToList(); // if there are no results, exit with a 1. - if (packageResults.Count == 0) + if (configuration.Features.UseEnhancedExitCodes && packageResults.Count == 0 && Environment.ExitCode == 0) { Environment.ExitCode = 1; } diff --git a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs index aaf876ca2e..263cf07f74 100644 --- a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs +++ b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs @@ -382,7 +382,8 @@ public sealed class FeaturesConfiguration public bool VirusCheck { get; set; } public bool FailOnInvalidOrMissingLicense { get; set; } public bool IgnoreInvalidOptionsSwitches { get; set; } - public bool UsePackageExitCodes { get; set; } + public bool UsePackageExitCodes { get; set; } + public bool UseEnhancedExitCodes { get; set; } public bool UseFipsCompliantChecksums { get; set; } public bool ShowNonElevatedWarnings { get; set; } public bool ShowDownloadProgress { get; set; } diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index 3ba579f767..0b4295d93d 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -656,7 +656,8 @@ Output is package name | current version | available version | pinned? } } - if (outdatedPackages.Count != 0 && Environment.ExitCode == 0) + // oudated packages, return 2 + if (config.Features.UseEnhancedExitCodes && outdatedPackages.Count != 0 && Environment.ExitCode == 0) { Environment.ExitCode = 2; } From a471a87bf9e06eebbc77ad83a6ae10a759a2a906 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 15:30:56 -0500 Subject: [PATCH 04/19] (GH-1724) search - exit 2 on no results Preserve 1 and -1 for errors. No results should have something more deterministic, and 2 would provide that. --- .../infrastructure.app/commands/ChocolateyListCommand.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs index 46d49d8aab..1ec9eca56b 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs @@ -204,10 +204,10 @@ public virtual void run(ChocolateyConfiguration configuration) // note: you must leave the .ToList() here or else the method won't be evaluated! var packageResults = _packageService.list_run(configuration).ToList(); - // if there are no results, exit with a 1. + // if there are no results, exit with a 2. if (configuration.Features.UseEnhancedExitCodes && packageResults.Count == 0 && Environment.ExitCode == 0) { - Environment.ExitCode = 1; + Environment.ExitCode = 2; } } From 181340b6106f0f093c209b5f6d6aa735dc6d244e Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 15:35:42 -0500 Subject: [PATCH 05/19] (doc) scripting - how to get exit code w/powershell Explain how to get the choco exit code with PowerShell as that may not be well-known. --- .../infrastructure.app/builders/ConfigurationBuilder.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index 84c373133c..97efcdc949 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -559,7 +559,9 @@ not source name ('https://chocolatey.org/api/v2' versus * Use exit codes to determine status. Chocolatey exits with 0 when everything worked appropriately and other exits codes like 1 when things error. There are package specific exit codes that are - recommended to be used and reboot indicating exit codes as well. + recommended to be used and reboot indicating exit codes as well. To + check exit code when using PowerShell, immediately call + `$exitCode = $LASTEXITCODE` to get the value choco exited with. Here's an example following bad practices (line breaks added for readability): From 28ee0c200b537f9fd835182e98e0718ae7df13d3 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 15:39:06 -0500 Subject: [PATCH 06/19] (doc) scripting - point to scripting reference Provide more awareness that there is a scripting guide in each command help in the examples section. --- .../infrastructure.app/commands/ChocolateyApiKeyCommand.cs | 3 +++ .../infrastructure.app/commands/ChocolateyConfigCommand.cs | 3 +++ .../infrastructure.app/commands/ChocolateyFeatureCommand.cs | 4 ++++ .../infrastructure.app/commands/ChocolateyInfoCommand.cs | 4 ++++ .../infrastructure.app/commands/ChocolateyInstallCommand.cs | 4 ++++ .../infrastructure.app/commands/ChocolateyListCommand.cs | 6 +++++- .../infrastructure.app/commands/ChocolateyNewCommand.cs | 3 +++ .../commands/ChocolateyOutdatedCommand.cs | 3 +++ .../infrastructure.app/commands/ChocolateyPackCommand.cs | 3 +++ .../infrastructure.app/commands/ChocolateyPinCommand.cs | 3 +++ .../infrastructure.app/commands/ChocolateyPushCommand.cs | 4 ++++ .../infrastructure.app/commands/ChocolateySourceCommand.cs | 3 +++ .../commands/ChocolateyUninstallCommand.cs | 4 ++++ .../infrastructure.app/commands/ChocolateyUpgradeCommand.cs | 4 ++++ 14 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs index 622a691c8a..c87d70274d 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs @@ -111,6 +111,9 @@ choco apikey your repository's documentation (for Nexus, please see https://bit.ly/nexus2apikey). +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Connecting to Chocolatey.org (Community Package Repository)"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs index 0bb1f247ab..e8f12e02da 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs @@ -116,6 +116,9 @@ choco config get --name cacheLocation choco config unset proxy choco config unset --name proxy +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "See It In Action"); "chocolatey".Log().Info(@" diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs index 85e3ab8fe1..f1d06bd081 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs @@ -97,6 +97,10 @@ choco feature choco feature list choco feature disable -n=bob choco feature enable -n=bob + +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs index 67e362e044..529c25f2a1 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs @@ -82,6 +82,10 @@ public override void help_message(ChocolateyConfiguration configuration) `choco search --exact --detailed`. NOTE: New as of 0.9.10.0. + +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index 66ddfa45e0..880634c12c 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -295,6 +295,10 @@ option to not allow PATH changes. Until then you will need to manually go modify Path to just one Ruby and then use something like uru (https://bitbucket.org/jonforums/uru) or pik (https://chocolatey.org/packages/pik) to switch between versions. + +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "See It In Action"); "chocolatey".Log().Info(@" diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs index 1ec9eca56b..61384f57e7 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs @@ -164,8 +164,12 @@ choco list -li choco list -lai choco list --page=0 --page-size=25 choco search git - choco search git -s ""'https://somewhere/out/there'"" + choco search git --source=""'https://somewhere/out/there'"" choco search bob -s ""'https://somewhere/protected'"" -u user -p pass + +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "See It In Action"); "chocolatey".Log().Info(@" diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs index 097c5ca8d0..cabad54bbe 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs @@ -157,6 +157,9 @@ This is called automatic recompile. choco new bob silentargs=""'/S'"" url=""'https://somewhere/out/there.msi'"" choco new bob --outputdirectory Packages +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs index 2d5cb3f95e..7ddd26ee55 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs @@ -101,6 +101,9 @@ choco outdated If you use `--source=https://somewhere/out/there`, it is going to look for outdated packages only based on that source. +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "See It In Action"); "chocolatey".Log().Info(@" diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs index 5d2f99e678..8f76f19160 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs @@ -110,6 +110,9 @@ choco pack choco pack path/to/nuspec choco pack --outputdirectory build +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs index d129e71c82..f18e66bba6 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs @@ -115,6 +115,9 @@ choco pin list choco pin add -n=git --version 1.2.3 choco pin remove --name git +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs index 0e48ab9895..6005df77b7 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs @@ -176,6 +176,10 @@ will require specifying the path to the file. choco push --source https://chocolatey.org/ choco push --source ""'https://chocolatey.org/'"" -t 500 choco push --source ""'https://chocolatey.org/'"" -k=""'123-123123-123'"" + +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Troubleshooting"); "chocolatey".Log().Info(()=> @" diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs index b5ba8d8954..e9609fd69c 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs @@ -153,6 +153,9 @@ choco source list it returns OData with something that says Packages in the browser, similar to what you see when you go to https://chocolatey.org/api/v2/. +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs index 75a0dacd3d..f34be3c753 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs @@ -226,6 +226,10 @@ choco uninstall notepadplusplus googlechrome atom 7zip choco uninstall notepadplusplus googlechrome atom 7zip -dv choco uninstall ruby --version 1.8.7.37402 choco uninstall nodejs.install --all-versions + +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs index 1ba3212e4d..8d888656ef 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs @@ -300,6 +300,10 @@ choco upgrade nodejs.install --version 0.10.35 choco upgrade git -s ""'https://somewhere/protected'"" -u user -p pass choco upgrade all choco upgrade all --except=""'skype,conemu'"" + +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "See It In Action"); "chocolatey".Log().Info(@" From 9bc55bec615c647ba6d4abf76d9d60f90e137990 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 15:45:20 -0500 Subject: [PATCH 07/19] (doc) outdated - note ignore unfound On specific sources, mention `--ignore-unfound` is available to ignore the packages that are not on those items. --- .../infrastructure.app/commands/ChocolateyOutdatedCommand.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs index 7ddd26ee55..c780dde579 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs @@ -99,7 +99,8 @@ choco outdated choco outdated -s ""'https://somewhere/protected'"" -u user -p pass If you use `--source=https://somewhere/out/there`, it is - going to look for outdated packages only based on that source. + going to look for outdated packages only based on that source, so + you may want to add `--ignore-unfound` to your options. NOTE: See scripting in the command reference (`choco -?`) for how to write proper scripts and integrations. From a9999c7ebc16f4070b856f3a418c97082d8a0802 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 16:18:29 -0500 Subject: [PATCH 08/19] (doc) info - add usage / examples --- .../commands/ChocolateyInfoCommand.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs index 529c25f2a1..f5fd8b75ac 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs @@ -83,6 +83,19 @@ public override void help_message(ChocolateyConfiguration configuration) NOTE: New as of 0.9.10.0. +"); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage"); + "chocolatey".Log().Info(@" + choco info [] +"); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Examples"); + "chocolatey".Log().Info(@" + choco info chocolatey + choco info googlechrome + choco info powershell + NOTE: See scripting in the command reference (`choco -?`) for how to write proper scripts and integrations. From 3c5afc5a1a87f8282c8b1fdf917a18fc308a61c5 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 16:20:43 -0500 Subject: [PATCH 09/19] (GH-1758)(doc) provide exit code docs Add exit code documentation to all of the commands. --- .../commands/ChocolateyApiKeyCommand.cs | 13 +++++++++ .../commands/ChocolateyConfigCommand.cs | 15 ++++++++++ .../commands/ChocolateyFeatureCommand.cs | 14 +++++++++ .../commands/ChocolateyInfoCommand.cs | 22 ++++++++++++++ .../commands/ChocolateyInstallCommand.cs | 29 +++++++++++++++++++ .../commands/ChocolateyListCommand.cs | 24 +++++++++++++++ .../commands/ChocolateyNewCommand.cs | 14 +++++++++ .../commands/ChocolateyOutdatedCommand.cs | 24 +++++++++++++++ .../commands/ChocolateyPackCommand.cs | 14 +++++++++ .../commands/ChocolateyPinCommand.cs | 14 +++++++++ .../commands/ChocolateyPushCommand.cs | 14 +++++++++ .../commands/ChocolateySourceCommand.cs | 14 +++++++++ .../commands/ChocolateyUninstallCommand.cs | 29 +++++++++++++++++++ .../commands/ChocolateyUpgradeCommand.cs | 29 +++++++++++++++++++ 14 files changed, 269 insertions(+) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs index c87d70274d..683038f285 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs @@ -127,6 +127,19 @@ choco apikey -k -s {0} ".format_with(ApplicationParameters.ChocolateyCommunityFeedPushSource)); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + +"); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs index e8f12e02da..1c996aeb9a 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs @@ -120,6 +120,21 @@ choco config unset --name proxy write proper scripts and integrations. "); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + +"); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "See It In Action"); "chocolatey".Log().Info(@" Config shown in action: https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/choco_config.gif diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs index f1d06bd081..e4ede290a9 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs @@ -101,6 +101,20 @@ choco feature list NOTE: See scripting in the command reference (`choco -?`) for how to write proper scripts and integrations. +"); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs index f5fd8b75ac..9dcbb7a5ca 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs @@ -100,6 +100,28 @@ choco info powershell write proper scripts and integrations. "); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Enhanced: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + - 2: no results (enhanced) + +NOTE: Starting in v0.10.12, if you have the feature '{0}' + turned on, then choco will provide enhanced exit codes that allow + better integration and scripting. + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + +".format_with(ApplicationParameters.Features.UseEnhancedExitCodes)); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index 880634c12c..04594f5563 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -300,6 +300,35 @@ go modify Path to just one Ruby and then use something like uru write proper scripts and integrations. "); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Package Exit Codes: + - 1641: success, reboot initiated + - 3010: success, reboot required + - other (not listed): likely an error has occurred + +In addition to normal exit codes, packages are allowed to exit + with their own codes when the feature '{0}' is + turned on. Uninstall command has additional valid exit codes. + Available in v0.9.10+. + +Reboot Exit Codes: + - 350: pending reboot detected, no action has occurred + - 1604: install suspended, incomplete + +In addition to the above exit codes, you may also see reboot exit codes + when the feature '{1}' is turned on. It typically requires + the feature '{0}' to also be turned on to work properly. + Available in v0.10.12+. +".format_with(ApplicationParameters.Features.UsePackageExitCodes, ApplicationParameters.Features.ExitOnRebootDetected)); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "See It In Action"); "chocolatey".Log().Info(@" Chocolatey FOSS install showing tab completion and `refreshenv` (a way diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs index 61384f57e7..f044dd899a 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs @@ -171,6 +171,30 @@ choco search git write proper scripts and integrations. "); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Enhanced: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + - 2: no results (enhanced) + +NOTE: Starting in v0.10.12, if you have the feature '{0}' + turned on, then choco will provide enhanced exit codes that allow + better integration and scripting. + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + +".format_with(ApplicationParameters.Features.UseEnhancedExitCodes)); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "See It In Action"); "chocolatey".Log().Info(@" choco search: https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/choco_search.gif diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs index cabad54bbe..6c5ddb194f 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs @@ -160,6 +160,20 @@ This is called automatic recompile. NOTE: See scripting in the command reference (`choco -?`) for how to write proper scripts and integrations. +"); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs index c780dde579..835ad38f2a 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs @@ -106,6 +106,30 @@ you may want to add `--ignore-unfound` to your options. write proper scripts and integrations. "); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Enhanced: + - 0: no outdated packages + - -1 or 1: an error has occurred + - 2: outdated packages have been found + +NOTE: Starting in v0.10.12, if you have the feature '{0}' + turned on, then choco will provide enhanced exit codes that allow + better integration and scripting. + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + +".format_with(ApplicationParameters.Features.UseEnhancedExitCodes)); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "See It In Action"); "chocolatey".Log().Info(@" choco outdated: https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/choco_outdated.gif diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs index 8f76f19160..b3cef3f13b 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs @@ -113,6 +113,20 @@ choco pack --outputdirectory build NOTE: See scripting in the command reference (`choco -?`) for how to write proper scripts and integrations. +"); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs index f18e66bba6..169e2469c9 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs @@ -118,6 +118,20 @@ choco pin remove --name git NOTE: See scripting in the command reference (`choco -?`) for how to write proper scripts and integrations. +"); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs index 6005df77b7..b19cb0cfb4 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs @@ -199,6 +199,20 @@ You can verify by going to {0}packages/packageName. and you don't see a good reason for it. ".format_with(ApplicationParameters.ChocolateyCommunityFeedPushSource)); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + +"); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs index e9609fd69c..25d5caf991 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs @@ -156,6 +156,20 @@ choco source list NOTE: See scripting in the command reference (`choco -?`) for how to write proper scripts and integrations. +"); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs index f34be3c753..991f2b8c4f 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs @@ -232,6 +232,35 @@ write proper scripts and integrations. "); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Package Exit Codes: + - 1605: software is not installed + - 1614: product is uninstalled + - 1641: success, reboot initiated + - 3010: success, reboot required + - other (not listed): likely an error has occurred + +In addition to normal exit codes, packages are allowed to exit + with their own codes when the feature '{0}' is + turned on. Available in v0.9.10+. + +Reboot Exit Codes: + - 350: pending reboot detected, no action has occurred + - 1604: install suspended, incomplete + +In addition to the above exit codes, you may also see reboot exit codes + when the feature '{1}' is turned on. It typically requires + the feature '{0}' to also be turned on to work properly. + Available in v0.10.12+. +".format_with(ApplicationParameters.Features.UsePackageExitCodes, ApplicationParameters.Features.ExitOnRebootDetected)); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); "chocolatey".Log().Info(@" NOTE: Options and switches apply to all items passed, so if you are diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs index 8d888656ef..b117aa2084 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs @@ -305,6 +305,35 @@ choco upgrade all write proper scripts and integrations. "); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Package Exit Codes: + - 1641: success, reboot initiated + - 3010: success, reboot required + - other (not listed): likely an error has occurred + +In addition to normal exit codes, packages are allowed to exit + with their own codes when the feature '{0}' is + turned on. Uninstall command has additional valid exit codes. + Available in v0.9.10+. + +Reboot Exit Codes: + - 350: pending reboot detected, no action has occurred + - 1604: install suspended, incomplete + +In addition to the above exit codes, you may also see reboot exit codes + when the feature '{1}' is turned on. It typically requires + the feature '{0}' to also be turned on to work properly. + Available in v0.10.12+. +".format_with(ApplicationParameters.Features.UsePackageExitCodes, ApplicationParameters.Features.ExitOnRebootDetected)); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "See It In Action"); "chocolatey".Log().Info(@" choco upgrade: https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/choco_upgrade.gif From bca094debb96735e793468a6fcc0d59acf6734cd Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 16:22:04 -0500 Subject: [PATCH 10/19] (maint) formatting --- .../infrastructure.app/commands/ChocolateyPushCommand.cs | 1 + .../infrastructure.app/commands/ChocolateyUpgradeCommand.cs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs index b19cb0cfb4..6ec0e0e0dd 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs @@ -181,6 +181,7 @@ will require specifying the path to the file. write proper scripts and integrations. "); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Troubleshooting"); "chocolatey".Log().Info(()=> @" To use this command, you must have your API key saved for the community diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs index b117aa2084..e839263887 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs @@ -340,7 +340,6 @@ Available in v0.10.12+. "); - "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); "chocolatey".Log().Info(@" NOTE: Options and switches apply to all items passed, so if you are From 3bb67b91a3793502f21f0542da45676c9758f947 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 16:22:23 -0500 Subject: [PATCH 11/19] (doc) update release notes --- CHANGELOG.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3557dabdae..e06cc2c0b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,26 @@ This covers changes for the "chocolatey" and "chocolatey.lib" packages, which ar **NOTE**: If you have a licensed edition of Chocolatey ("chocolatey.extension"), refer to this in tandem with [Chocolatey Licensed CHANGELOG](https://github.com/chocolatey/choco/blob/master/CHANGELOG_LICENSED.md). ## [0.10.12](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.12+is%3Aclosed) - (March 14, 2019) +We are pretty excited to finally share a new Chocolatey release! And this release won't disappoint. Loads of bug fixes, enhanced exit codes for search, list, info and outdated when results are returned versus nothing being returned, and some really nice improvements. + +Perhaps the biggest addition this release is the ability to halt installation if a reboot is detected ([#1038](https://github.com/chocolatey/choco/issues/1038)). Once you turn this feature on, if you are installing some packages and somewhere in the middle of that there is a need for a reboot, Chocolatey will stop and exit with either exit code 350 (pending reboot prior to anything) or 1604 (install incomplete), indicating a reboot is needed to continue. It won't reboot for you, as it is just a package manager - but it will stop execution so nothing that may error on install is attemtped. You'll need to opt into this feature, so see [#1038](https://github.com/chocolatey/choco/issues/1038) for details. + +If you've long hated the default console colors, we've spent quite a bit of time detecting the background console color and adjusting the colorization output of Chocolatey for this release ([#1131](https://github.com/chocolatey/choco/issues/1131)). You might give that a whirl and see if you can turn back on console colors for good. + +We've added the ability to validate the configuration and system state at a global level ([#1746](https://github.com/chocolatey/choco/issues/1746)). It's early, but expect that we'll do a lot more to really provide good experiences in this area. + +A bug that is worth noting as fixed is having choco exit when a source fails instead of ignoring it ([#612](https://github.com/chocolatey/choco/issues/612)). This is now fixed! + +The last thing worth noting in the summary is Enhanced Exit Codes, or providing more intentional exit codes that mean something instead of just 0 or 1 ([#1758](https://github.com/chocolatey/choco/issues/1758)). In this release, outdated and search commands will have additional exit codes that mean something. This is noted in the next section, so please read over and see how to shut off this behavior if you see it breaking any integration you might be using (including your own scripts). + +### BREAKING CHANGES + * outdated - Exit 2 when there are packages out of date - see [#1602](https://github.com/chocolatey/choco/issues/1602) + * search/list/info - Exit 2 when no results are returned - see [#1724](https://github.com/chocolatey/choco/issues/1724) + +We've listed these as breaking changes as it may affect tools that are integrating with Chocolatey and interpreting the output of the exit code. In these cases, it would likely temporarily break those tools until they've had a chance to release new versions of their tools. If you run into this, you simply need to turn off the feature "useEnhancedExitCodes". That is as simple as `choco feature disable --name="'useEnhancedExitCodes'"` ([#1758](https://github.com/chocolatey/choco/issues/1758)). + ### FEATURES - * Halt install if dependency requires a reboot - see [#1038](https://github.com/chocolatey/choco/issues/1038) + * Exit when reboot is detected - w/350 for pending & w/1604 on dependency package requiring reboot - see [#1038](https://github.com/chocolatey/choco/issues/1038) ### BUG FIXES * [Security] Fix - upgrade - remove automation scripts prior to upgrade even if changed - see [#1689](https://github.com/chocolatey/choco/issues/1689) @@ -33,13 +51,11 @@ This covers changes for the "chocolatey" and "chocolatey.lib" packages, which ar ### IMPROVEMENTS * [Security] tools - Update 7z to 18.06 Enhancement Security - see [#1704](https://github.com/chocolatey/choco/issues/1704) * [Security] Refreshenv script leaves temporary file behind - see [#1549](https://github.com/chocolatey/choco/issues/1549) - * Halt install if dependency requires a reboot - see [#1038](https://github.com/chocolatey/choco/issues/1038) + * Control enhanced exit codes with a feature switch - see [#1758](https://github.com/chocolatey/choco/issues/1758) * Logging - better default colors - see [#1131](https://github.com/chocolatey/choco/issues/1131) * Validate config / system state across everything - see [#1746](https://github.com/chocolatey/choco/issues/1746) * upgrade - switch for not installing if not installed - see [#1646](https://github.com/chocolatey/choco/issues/1646) * outdated - improve performance of `choco outdated` - see [#1397](https://github.com/chocolatey/choco/issues/1397) - * outdated - Use exit codes to determine update status - see [#1602](https://github.com/chocolatey/choco/issues/1602) - * search/list/info - exit 1 when no results are returned - see [#1724](https://github.com/chocolatey/choco/issues/1724) * search/list - Add alias "find" for search - see [#1744](https://github.com/chocolatey/choco/issues/1744) * apikey - Enable removal of API key via CLI - see [#1301](https://github.com/chocolatey/choco/issues/1301) * Logging - Choco --log-file option should create log files relative to current directory - see [#1603](https://github.com/chocolatey/choco/issues/1603) From 968a84a9ebbe08c9b728799bed337ed561ddb4bf Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 16:23:57 -0500 Subject: [PATCH 12/19] (maint) whitespace --- .../infrastructure.app/commands/ChocolateyUninstallCommand.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs index 991f2b8c4f..e6c67a84e4 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs @@ -247,8 +247,8 @@ Exit codes that normally result from running this command. - 3010: success, reboot required - other (not listed): likely an error has occurred -In addition to normal exit codes, packages are allowed to exit - with their own codes when the feature '{0}' is +In addition to normal exit codes, packages are allowed to exit + with their own codes when the feature '{0}' is turned on. Available in v0.9.10+. Reboot Exit Codes: From 7652f6af6f7ed1d32164ae8b650b2e61e5b47a47 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 16:50:00 -0500 Subject: [PATCH 13/19] (doc) update release notes for licensed extension --- CHANGELOG_LICENSED.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/CHANGELOG_LICENSED.md b/CHANGELOG_LICENSED.md index eb6a2a4bee..9933f78cb9 100644 --- a/CHANGELOG_LICENSED.md +++ b/CHANGELOG_LICENSED.md @@ -4,6 +4,35 @@ This covers changes for the "chocolatey.extension" package, where the licensed e **NOTE**: If you have a licensed edition of Chocolatey, refer to this in tandem with [Chocolatey Open source CHANGELOG](https://github.com/chocolatey/choco/blob/master/CHANGELOG.md). +## 2.0.0 (March 14, 2019) +### FEATURES + * Chocolatey Central Management tie in - Brings Central Management client configuration to Chocolatey. Requires Chocolatey v0.10.12 along with Chocolatey Agent v0.9.0 to allow communication with Central Maangement. + * [Security] Self-Service - allow uninstalls of ONLY packages installed by a user. Allows restricting what a user can uninstall to only what they have installed - see [licensed #2](https://github.com/chocolatey/chocolatey-licensed-issues/issues/2) + +### BUG FIXES + * Self-Service / Background Mode: + * Fix - Package arguments not being passed from Agent to choco.exe properly (client side fixes) - see [licensed #60](https://github.com/chocolatey/chocolatey-licensed-issues/issues/60) + * Fix - Background Service does not pass the exit code back to the console (client side) - see [licensed #51](https://github.com/chocolatey/chocolatey-licensed-issues/issues/51) + * Package Internalizer (Choco Download): + * Fix - PackageInternalizer - UseOriginalLocation switch being appended inappropriately when line continuation is used with no arguments on first line - see [licensed #64](https://github.com/chocolatey/chocolatey-licensed-issues/issues/64) + * Package Upload UI: + * Fix - Package Uploader is unable to push to a non https source - see [licensed #49](https://github.com/chocolatey/chocolatey-licensed-issues/issues/49) + * Package Builder (Choco New): + * Fix - Nuspec files section should not be commented out as it doesn't allow subdirectories + * Fix - Ensure Architect and MSP are able to use Package Builder + * Fix - Escape XML characters in generated nuspec file + * Windows Service Management Functions: + * Fix - When shutting down a Windows service it may hold a lock on a file for a second after it shuts down + * Fix - Type detection holds file locks if it times out - see [licensed #59](https://github.com/chocolatey/chocolatey-licensed-issues/issues/59) + * Fix - Ensure Architect edition has all features set appropriately + +### IMPROVEMENTS + * Package Builder - Remove "v" as part of "Name v2.2.23" In product names + * Package Upload UI - Ability to auto populate Source dropdown list - see [licensed #50](https://github.com/chocolatey/chocolatey-licensed-issues/issues/50) + * Package Internalizer - Allow downloading all installed packages with `--installed-packages` + * PowerShell - Cmdlets for Getting/Setting encrypted values in JSON files + + ## 1.12.12 (June 12, 2018) ### FEATURES * Package Upload UI - Ability to right click on a nupkg, and access UI for selecting where package is pushed to From c84ca40b61994ff56d43577ad80900c12e279dc2 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 16:54:10 -0500 Subject: [PATCH 14/19] (GH-1746) allow shutting off validation warnings If warnings tend to start to annoy someone, they may want to shut them off, provide the ability to do so. --- .../infrastructure.app/ApplicationParameters.cs | 1 + .../builders/ConfigurationBuilder.cs | 2 +- .../configuration/ChocolateyConfiguration.cs | 1 + .../infrastructure.app/runners/ConsoleApplication.cs | 10 ++++++---- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/chocolatey/infrastructure.app/ApplicationParameters.cs b/src/chocolatey/infrastructure.app/ApplicationParameters.cs index 75cf0f7dcc..8298a63912 100644 --- a/src/chocolatey/infrastructure.app/ApplicationParameters.cs +++ b/src/chocolatey/infrastructure.app/ApplicationParameters.cs @@ -179,6 +179,7 @@ public static class Features public static readonly string RemovePackageInformationOnUninstall = "removePackageInformationOnUninstall"; public static readonly string LogWithoutColor = "logWithoutColor"; public static readonly string ExitOnRebootDetected = "exitOnRebootDetected"; + public static readonly string LogValidationResultsOnWarnings = "logValidationResultsOnWarnings"; } public static class Messages diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index 97efcdc949..ced121e7cf 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -302,7 +302,7 @@ private static void set_feature_flags(ChocolateyConfiguration config, ConfigFile config.Features.SkipPackageUpgradesWhenNotInstalled = set_feature_flag(ApplicationParameters.Features.SkipPackageUpgradesWhenNotInstalled, configFileSettings, defaultEnabled: false, description: "Skip Packages Not Installed During Upgrade - if a package is not installed, do not install it during the upgrade process. Available in 0.10.12+."); config.Features.RemovePackageInformationOnUninstall = set_feature_flag(ApplicationParameters.Features.RemovePackageInformationOnUninstall, configFileSettings, defaultEnabled: false, description: "Remove Stored Package Information On Uninstall - When a package is uninstalled, should the stored package information also be removed? Available in 0.10.9+."); config.Features.LogWithoutColor = set_feature_flag(ApplicationParameters.Features.LogWithoutColor, configFileSettings, defaultEnabled: false, description: "Log without color - Do not show colorization in logging output. Available in 0.10.9+."); - + config.Features.LogValidationResultsOnWarnings = set_feature_flag(ApplicationParameters.Features.LogValidationResultsOnWarnings, configFileSettings, defaultEnabled: true, description: "Log validation results on warnings - Should the validation results be logged if there are warnings? Available in 0.10.12+."); config.Features.ScriptsCheckLastExitCode = set_feature_flag(ApplicationParameters.Features.ScriptsCheckLastExitCode, configFileSettings, defaultEnabled: false, description: "Scripts Check $LastExitCode (external commands) - Leave this off unless you absolutely need it while you fix your package scripts to use `throw 'error message'` or `Set-PowerShellExitCode #` instead of `exit #`. This behavior started in 0.9.10 and produced hard to find bugs. If the last external process exits successfully but with an exit code of not zero, this could cause hard to detect package failures. Available in 0.10.3+. Will be removed in 0.11.0."); config.PromptForConfirmation = !set_feature_flag(ApplicationParameters.Features.AllowGlobalConfirmation, configFileSettings, defaultEnabled: false, description: "Prompt for confirmation in scripts or bypass."); config.Features.ExitOnRebootDetected = set_feature_flag(ApplicationParameters.Features.ExitOnRebootDetected, configFileSettings, defaultEnabled: false, description: "Exit On Reboot Detected - Stop running install, upgrade, or uninstall when a reboot request is detected. Requires '{0}' feature to be turned on. Will exit with either {1} or {2}. When it exits with {1}, it means pending reboot discovered prior to running operation. When it exits with {2}, it means some work completed prior to reboot request being detected. As this will affect upgrade all, it is normally recommended to leave this off. Available in 0.10.12+.".format_with(ApplicationParameters.Features.ExitOnRebootDetected, ApplicationParameters.ExitCodes.ErrorFailNoActionReboot, ApplicationParameters.ExitCodes.ErrorInstallSuspend)); diff --git a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs index 263cf07f74..63ceba52a0 100644 --- a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs +++ b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs @@ -393,6 +393,7 @@ public sealed class FeaturesConfiguration public bool SkipPackageUpgradesWhenNotInstalled { get; set; } public bool RemovePackageInformationOnUninstall { get; set; } public bool ExitOnRebootDetected { get; set; } + public bool LogValidationResultsOnWarnings { get; set; } //todo remove in 0.11.0 public bool ScriptsCheckLastExitCode { get; set; } diff --git a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs index 32a240c8e7..654b0c72fa 100644 --- a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs +++ b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs @@ -119,9 +119,10 @@ private int report_validation_summary(IList validationResults, var warnings = validationResults.Count(v => v.Status == ValidationStatus.Warning); var errors = validationResults.Count(v => v.Status == ValidationStatus.Error); + var logOnWarnings = config.Features.LogValidationResultsOnWarnings; if (config.RegularOutput) { - this.Log().Info(errors + warnings == 0 ? ChocolateyLoggers.LogFileOnly : ChocolateyLoggers.Important, () => "{0} validations performed. {1} success(es), {2} warning(s), and {3} error(s).".format_with( + this.Log().Info(errors + (logOnWarnings ? warnings : 0) == 0 ? ChocolateyLoggers.LogFileOnly : ChocolateyLoggers.Important, () => "{0} validations performed. {1} success(es), {2} warning(s), and {3} error(s).".format_with( validationResults.Count, successes, warnings, @@ -129,11 +130,12 @@ private int report_validation_summary(IList validationResults, if (warnings != 0) { - this.Log().Info(""); - this.Log().Warn("Validation Warnings:"); + var warningLogger = logOnWarnings ? ChocolateyLoggers.Normal : ChocolateyLoggers.LogFileOnly; + this.Log().Info(warningLogger, ""); + this.Log().Warn(warningLogger, "Validation Warnings:"); foreach (var warning in validationResults.Where(p => p.Status == ValidationStatus.Warning).or_empty_list_if_null()) { - this.Log().Warn(" - {0}".format_with(warning.Message)); + this.Log().Warn(warningLogger, " - {0}".format_with(warning.Message)); } } } From a9f32841db3bc555d9f0b18a598711a4a8280fea Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 16:55:41 -0500 Subject: [PATCH 15/19] (GH-1038) remove note on off recommendation For exit on reboot detected, it's actually best to have it on as it makes things more reliable for installations. Remove the note that mentions otherwise. --- .../infrastructure.app/builders/ConfigurationBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index ced121e7cf..f1ca867f3a 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -293,6 +293,7 @@ private static void set_feature_flags(ChocolateyConfiguration config, ConfigFile config.Features.IgnoreInvalidOptionsSwitches = set_feature_flag(ApplicationParameters.Features.IgnoreInvalidOptionsSwitches, configFileSettings, defaultEnabled: true, description: "Ignore Invalid Options/Switches - If a switch or option is passed that is not recognized, should choco fail? Available in 0.9.10+."); config.Features.UsePackageExitCodes = set_feature_flag(ApplicationParameters.Features.UsePackageExitCodes, configFileSettings, defaultEnabled: true, description: "Use Package Exit Codes - Package scripts can provide exit codes. With this on, package exit codes will be what choco uses for exit when non-zero (this value can come from a dependency package). Chocolatey defines valid exit codes as 0, 1605, 1614, 1641, 3010. With this feature off, choco will exit with 0, 1, or -1 (matching previous behavior). Available in 0.9.10+."); config.Features.UseEnhancedExitCodes = set_feature_flag(ApplicationParameters.Features.UseEnhancedExitCodes, configFileSettings, defaultEnabled: true, description: "Use Enhanced Exit Codes - Chocolatey is able to provide enhanced exit codes surrounding list, search, info, outdated and other commands that don't deal directly with package operations. To see enhanced exit codes and their meanings, please run `choco [cmdname] -?`. With this feature off, choco will exit with 0, 1, or -1 (matching previous behavior). Available in 0.10.12+."); + config.Features.ExitOnRebootDetected = set_feature_flag(ApplicationParameters.Features.ExitOnRebootDetected, configFileSettings, defaultEnabled: false, description: "Exit On Reboot Detected - Stop running install, upgrade, or uninstall when a reboot request is detected. Requires '{0}' feature to be turned on. Will exit with either {1} or {2}. When it exits with {1}, it means pending reboot discovered prior to running operation. When it exits with {2}, it means some work completed prior to reboot request being detected. Available in 0.10.12+.".format_with(ApplicationParameters.Features.ExitOnRebootDetected, ApplicationParameters.ExitCodes.ErrorFailNoActionReboot, ApplicationParameters.ExitCodes.ErrorInstallSuspend)); config.Features.UseFipsCompliantChecksums = set_feature_flag(ApplicationParameters.Features.UseFipsCompliantChecksums, configFileSettings, defaultEnabled: false, description: "Use FIPS Compliant Checksums - Ensure checksumming done by choco uses FIPS compliant algorithms. Not recommended unless required by FIPS Mode. Enabling on an existing installation could have unintended consequences related to upgrades/uninstalls. Available in 0.9.10+."); config.Features.ShowNonElevatedWarnings = set_feature_flag(ApplicationParameters.Features.ShowNonElevatedWarnings, configFileSettings, defaultEnabled: true, description: "Show Non-Elevated Warnings - Display non-elevated warnings. Available in 0.10.4+."); config.Features.ShowDownloadProgress = set_feature_flag(ApplicationParameters.Features.ShowDownloadProgress, configFileSettings, defaultEnabled: true, description: "Show Download Progress - Show download progress percentages in the CLI. Available in 0.10.4+."); @@ -305,7 +306,6 @@ private static void set_feature_flags(ChocolateyConfiguration config, ConfigFile config.Features.LogValidationResultsOnWarnings = set_feature_flag(ApplicationParameters.Features.LogValidationResultsOnWarnings, configFileSettings, defaultEnabled: true, description: "Log validation results on warnings - Should the validation results be logged if there are warnings? Available in 0.10.12+."); config.Features.ScriptsCheckLastExitCode = set_feature_flag(ApplicationParameters.Features.ScriptsCheckLastExitCode, configFileSettings, defaultEnabled: false, description: "Scripts Check $LastExitCode (external commands) - Leave this off unless you absolutely need it while you fix your package scripts to use `throw 'error message'` or `Set-PowerShellExitCode #` instead of `exit #`. This behavior started in 0.9.10 and produced hard to find bugs. If the last external process exits successfully but with an exit code of not zero, this could cause hard to detect package failures. Available in 0.10.3+. Will be removed in 0.11.0."); config.PromptForConfirmation = !set_feature_flag(ApplicationParameters.Features.AllowGlobalConfirmation, configFileSettings, defaultEnabled: false, description: "Prompt for confirmation in scripts or bypass."); - config.Features.ExitOnRebootDetected = set_feature_flag(ApplicationParameters.Features.ExitOnRebootDetected, configFileSettings, defaultEnabled: false, description: "Exit On Reboot Detected - Stop running install, upgrade, or uninstall when a reboot request is detected. Requires '{0}' feature to be turned on. Will exit with either {1} or {2}. When it exits with {1}, it means pending reboot discovered prior to running operation. When it exits with {2}, it means some work completed prior to reboot request being detected. As this will affect upgrade all, it is normally recommended to leave this off. Available in 0.10.12+.".format_with(ApplicationParameters.Features.ExitOnRebootDetected, ApplicationParameters.ExitCodes.ErrorFailNoActionReboot, ApplicationParameters.ExitCodes.ErrorInstallSuspend)); } private static bool set_feature_flag(string featureName, ConfigFileSettings configFileSettings, bool defaultEnabled, string description) From e0f694dafcd54ccdb48adc3f81829dc572035c00 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 16:55:57 -0500 Subject: [PATCH 16/19] (doc) fix grammar --- .../infrastructure.app/validations/SystemStateValidation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs b/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs index 5a8bf1c37e..2b40d1c0f9 100644 --- a/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs +++ b/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs @@ -85,7 +85,7 @@ being ignored due to the current Chocolatey configuration. If you want to halt when this occurs, then either set the global feature using: choco feature enable -name={0} - or, pass the option --exit-when-reboot-detected. + or pass the option --exit-when-reboot-detected. ".format_with(ApplicationParameters.Features.ExitOnRebootDetected), Status = ValidationStatus.Warning, ExitCode = 0 From ec77cb666b3804775423b343412d82469c41e441 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 16:56:08 -0500 Subject: [PATCH 17/19] (version) 0.10.12 --- .uppercut | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.uppercut b/.uppercut index 98a14d6038..6269f0baaa 100644 --- a/.uppercut +++ b/.uppercut @@ -19,8 +19,8 @@ - - + + From 9d2c42a5743e9179f3e49ce34bab4f1d6dbdaf0f Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 19:36:18 -0500 Subject: [PATCH 18/19] (doc) update generated docs --- docs/generated/CommandsApiKey.md | 19 +++ docs/generated/CommandsConfig.md | 16 +++ docs/generated/CommandsFeature.md | 21 +++- docs/generated/CommandsFeatures.md | 21 +++- docs/generated/CommandsInfo.md | 37 ++++++ docs/generated/CommandsInstall.md | 55 ++++++++- docs/generated/CommandsList.md | 28 ++++- docs/generated/CommandsNew.md | 16 +++ docs/generated/CommandsOutdated.md | 28 ++++- docs/generated/CommandsPack.md | 16 +++ docs/generated/CommandsPin.md | 20 ++- docs/generated/CommandsPush.md | 17 +++ docs/generated/CommandsReference.md | 116 +++++++++++++++++- docs/generated/CommandsSearch.md | 28 ++++- docs/generated/CommandsSetapiKey.md | 19 +++ docs/generated/CommandsSource.md | 22 +++- docs/generated/CommandsSources.md | 22 +++- docs/generated/CommandsUninstall.md | 56 ++++++++- docs/generated/CommandsUpgrade.md | 66 +++++++++- .../HelpersInstallChocolateyShortcut.md | 7 +- 20 files changed, 597 insertions(+), 33 deletions(-) diff --git a/docs/generated/CommandsApiKey.md b/docs/generated/CommandsApiKey.md index aa90f27a0f..a19189e45f 100644 --- a/docs/generated/CommandsApiKey.md +++ b/docs/generated/CommandsApiKey.md @@ -34,6 +34,9 @@ user name and password specified as 'user:password' for the API key. Please see your repository's documentation (for Nexus, please see https://bit.ly/nexus2apikey). +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + ## Connecting to Chocolatey.org (Community Package Repository) @@ -45,6 +48,19 @@ In order to save your API key for https://push.chocolatey.org/, choco apikey -k -s https://push.chocolatey.org/ +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + + ## Options and Switches **NOTE:** Options and switches apply to all items passed, so if you are @@ -162,6 +178,9 @@ Includes [[default options/switches|CommandsReference#default-options-and-switch this is either a key or it could be a user name and password specified as 'user:password'. + --rem, --remove + Removes an API key from Chocolatey + ~~~ [[Command Reference|CommandsReference]] diff --git a/docs/generated/CommandsConfig.md b/docs/generated/CommandsConfig.md index 63d8febdb2..1ada716700 100644 --- a/docs/generated/CommandsConfig.md +++ b/docs/generated/CommandsConfig.md @@ -23,6 +23,22 @@ Chocolatey will allow you to interact with the configuration file settings. choco config unset proxy choco config unset --name proxy +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + ## See It In Action diff --git a/docs/generated/CommandsFeature.md b/docs/generated/CommandsFeature.md index 774408f067..1735ebe112 100644 --- a/docs/generated/CommandsFeature.md +++ b/docs/generated/CommandsFeature.md @@ -15,6 +15,23 @@ Chocolatey will allow you to interact with features. choco feature disable -n=bob choco feature enable -n=bob +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + + ## Options and Switches **NOTE:** Options and switches apply to all items passed, so if you are @@ -124,8 +141,8 @@ Includes [[default options/switches|CommandsReference#default-options-and-switch 0.8+. -n, --name=VALUE - Name - the name of the source. Required with some actions. Defaults to - empty. + Name - the name of the source. Required with actions other than list. + Defaults to empty. ~~~ diff --git a/docs/generated/CommandsFeatures.md b/docs/generated/CommandsFeatures.md index c4634e2e77..d551dc1836 100644 --- a/docs/generated/CommandsFeatures.md +++ b/docs/generated/CommandsFeatures.md @@ -15,6 +15,23 @@ Chocolatey will allow you to interact with features. choco feature disable -n=bob choco feature enable -n=bob +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + + ## Options and Switches **NOTE:** Options and switches apply to all items passed, so if you are @@ -124,8 +141,8 @@ Includes [[default options/switches|CommandsReference#default-options-and-switch 0.8+. -n, --name=VALUE - Name - the name of the source. Required with some actions. Defaults to - empty. + Name - the name of the source. Required with actions other than list. + Defaults to empty. ~~~ diff --git a/docs/generated/CommandsInfo.md b/docs/generated/CommandsInfo.md index 5fcb1a4a37..224683c4be 100644 --- a/docs/generated/CommandsInfo.md +++ b/docs/generated/CommandsInfo.md @@ -8,6 +8,43 @@ Chocolatey will perform a search for a package local or remote and provide **NOTE:** New as of 0.9.10.0. + +## Usage + + choco info [] + +## Examples + + choco info chocolatey + choco info googlechrome + choco info powershell + +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Enhanced: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + - 2: no results (enhanced) + +**NOTE:** Starting in v0.10.12, if you have the feature 'useEnhancedExitCodes' + turned on, then choco will provide enhanced exit codes that allow + better integration and scripting. + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + + ## Options and Switches **NOTE:** Options and switches apply to all items passed, so if you are diff --git a/docs/generated/CommandsInstall.md b/docs/generated/CommandsInstall.md index 149d5e264c..d6d21bf618 100644 --- a/docs/generated/CommandsInstall.md +++ b/docs/generated/CommandsInstall.md @@ -23,13 +23,13 @@ Installs a package or a list of packages (sometimes specified as a **NOTE:** Any package name ending with .config is considered a 'packages.config' file. Please see https://bit.ly/packages_config -**NOTE:** [Chocolatey Pro](https://chocolatey.org/compare) / Business builds on top of a great open source - experience with quite a few features that enhance the your use of the +**NOTE:** [Chocolatey Pro](https://chocolatey.org/compare) / Business builds on top of a great open source + experience with quite a few features that enhance the your use of the community package repository (when using Pro), and really enhance the Chocolatey experience all around. If you are an organization looking for a better ROI, look no further than Business - automatic package creation from installer files, automatic recompile support, runtime - malware protection, private CDN download cache, synchronize with + malware protection, private CDN download cache, synchronize with Programs and Features, etc - https://chocolatey.org/compare. @@ -39,7 +39,11 @@ Installs a package or a list of packages (sometimes specified as a choco install notepadplusplus googlechrome atom 7zip choco install notepadplusplus --force --force-dependencies choco install notepadplusplus googlechrome atom 7zip -dvfy - choco install git --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'" -y + choco install git -y --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'" + choco install git -y --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'" --install-args="'/DIR=C:\git'" + # Params are package parameters, passed to the package + # Install args are installer arguments, appended to the silentArgs + # in the package for the installer itself choco install nodejs.install --version 0.10.35 choco install git -s "'https://somewhere/out/there'" choco install git -s "'https://somewhere/protected'" -u user -p pass @@ -65,6 +69,37 @@ What is `-my`? See option bundling in [[how to pass arguments|CommandsReference# (https://bitbucket.org/jonforums/uru) or pik (https://chocolatey.org/packages/pik) to switch between versions. +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Package Exit Codes: + - 1641: success, reboot initiated + - 3010: success, reboot required + - other (not listed): likely an error has occurred + +In addition to normal exit codes, packages are allowed to exit + with their own codes when the feature 'usePackageExitCodes' is + turned on. Uninstall command has additional valid exit codes. + Available in v0.9.10+. + +Reboot Exit Codes: + - 350: pending reboot detected, no action has occurred + - 1604: install suspended, incomplete + +In addition to the above exit codes, you may also see reboot exit codes + when the feature 'exitOnRebootDetected' is turned on. It typically requires + the feature 'usePackageExitCodes' to also be turned on to work properly. + Available in v0.10.12+. + ## See It In Action Chocolatey FOSS install showing tab completion and `refreshenv` (a way @@ -392,6 +427,18 @@ Includes [[default options/switches|CommandsReference#default-options-and-switch Overrides the default feature 'stopOnFirstPackageFailure' set to 'False- '. Available in 0.10.4+. + --exitwhenrebootdetected, --exit-when-reboot-detected + Exit When Reboot Detected - Stop running install, upgrade, or uninstall + when a reboot request is detected. Requires 'usePackageExitCodes' + feature to be turned on. Will exit with either 350 or 1604. Overrides + the default feature 'exitOnRebootDetected' set to 'False'. Available in + 0.10.12+. + + --ignoredetectedreboot, --ignore-detected-reboot + Ignore Detected Reboot - Ignore any detected reboots if found. Overrides + the default feature 'exitOnRebootDetected' set to 'False'. Available in + 0.10.12+. + --sdc, --skipdownloadcache, --skip-download-cache Skip Download Cache - Use the original download even if a private CDN cache is available for a package. Overrides the default feature diff --git a/docs/generated/CommandsList.md b/docs/generated/CommandsList.md index 7bc40e9592..6a1a84cdc2 100644 --- a/docs/generated/CommandsList.md +++ b/docs/generated/CommandsList.md @@ -23,9 +23,35 @@ Chocolatey will perform a search for a package local or remote. Some choco list -lai choco list --page=0 --page-size=25 choco search git - choco search git -s "'https://somewhere/out/there'" + choco search git --source="'https://somewhere/out/there'" choco search bob -s "'https://somewhere/protected'" -u user -p pass +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Enhanced: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + - 2: no results (enhanced) + +**NOTE:** Starting in v0.10.12, if you have the feature 'useEnhancedExitCodes' + turned on, then choco will provide enhanced exit codes that allow + better integration and scripting. + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + + ## See It In Action ![choco search](https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/choco_search.gif) diff --git a/docs/generated/CommandsNew.md b/docs/generated/CommandsNew.md index c712fc058d..1c99b0cbe1 100644 --- a/docs/generated/CommandsNew.md +++ b/docs/generated/CommandsNew.md @@ -53,6 +53,22 @@ Possible properties to pass: choco new bob silentargs="'/S'" url="'https://somewhere/out/there.msi'" choco new bob --outputdirectory Packages +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + ## Options and Switches diff --git a/docs/generated/CommandsOutdated.md b/docs/generated/CommandsOutdated.md index d87a026281..4ef0b540a2 100644 --- a/docs/generated/CommandsOutdated.md +++ b/docs/generated/CommandsOutdated.md @@ -18,7 +18,33 @@ Returns a list of outdated packages. choco outdated -s "'https://somewhere/protected'" -u user -p pass If you use `--source=https://somewhere/out/there`, it is - going to look for outdated packages only based on that source. + going to look for outdated packages only based on that source, so + you may want to add `--ignore-unfound` to your options. + +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Enhanced: + - 0: no outdated packages + - -1 or 1: an error has occurred + - 2: outdated packages have been found + +**NOTE:** Starting in v0.10.12, if you have the feature 'useEnhancedExitCodes' + turned on, then choco will provide enhanced exit codes that allow + better integration and scripting. + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. ## See It In Action diff --git a/docs/generated/CommandsPack.md b/docs/generated/CommandsPack.md index d01dc26eb1..27a367ec3c 100644 --- a/docs/generated/CommandsPack.md +++ b/docs/generated/CommandsPack.md @@ -29,6 +29,22 @@ Chocolatey will attempt to package a nuspec into a compiled nupkg. Some choco pack path/to/nuspec choco pack --outputdirectory build +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + ## Options and Switches diff --git a/docs/generated/CommandsPin.md b/docs/generated/CommandsPin.md index a50e717ec4..d2dc4839ea 100644 --- a/docs/generated/CommandsPin.md +++ b/docs/generated/CommandsPin.md @@ -14,12 +14,28 @@ This is especially helpful when running [[`choco upgrade`|Commandsupgrade]] for ## Examples - choco pin - choco pin list + choco pin + choco pin list choco pin add -n=git choco pin add -n=git --version 1.2.3 choco pin remove --name git +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + ## Options and Switches diff --git a/docs/generated/CommandsPush.md b/docs/generated/CommandsPush.md index d87bd845f5..eec789429d 100644 --- a/docs/generated/CommandsPush.md +++ b/docs/generated/CommandsPush.md @@ -30,6 +30,10 @@ A feed can be a local folder, a file share, the [community feed](https://chocola choco push --source "'https://chocolatey.org/'" -t 500 choco push --source "'https://chocolatey.org/'" -k="'123-123123-123'" +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + ## Troubleshooting To use this command, you must have your API key saved for the community @@ -47,6 +51,19 @@ A common error is `Failed to process request. 'The specified API key Please contact the administrators of https://push.chocolatey.org/ if you see this and you don't see a good reason for it. +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + + ## Options and Switches **NOTE:** Options and switches apply to all items passed, so if you are diff --git a/docs/generated/CommandsReference.md b/docs/generated/CommandsReference.md index 84a5801eb9..5299d5b128 100644 --- a/docs/generated/CommandsReference.md +++ b/docs/generated/CommandsReference.md @@ -59,9 +59,6 @@ You can pass options and switches in the following ways: (`` `"value`" ``) or apostrophes (`'value'`). Using the combination allows for both shells to work without issue, except for when the next section applies. - * **Periods in PowerShell**: If you need to pass a period as part of a - value or a path, PowerShell doesn't always handle it well. Please - quote those values using "Quote Values" section above. * **Pass quotes in arguments**: When you need to pass quoted values to to something like a native installer, you are in for a world of fun. In cmd.exe you must pass it like this: `-ia "/yo=""Spaces spaces"""`. In @@ -69,12 +66,125 @@ You can pass options and switches in the following ways: No other combination will work. In PowerShell.exe if you are on version v3+, you can try `--%` before `-ia` to just pass the args through as is, which means it should not require any special workarounds. + * **Periods in PowerShell**: If you need to pass a period as part of a + value or a path, PowerShell doesn't always handle it well. Please + quote those values using "Quote Values" section above. * Options and switches apply to all items passed, so if you are installing multiple packages, and you use `--version=1.0.0`, choco is going to look for and try to install version 1.0.0 of every package passed. So please split out multiple package calls when wanting to pass specific options. +## Scripting / Integration - Best Practices / Style Guide + +When writing scripts, such as PowerShell scripts passing options and +switches, there are some best practices to follow to ensure that you +don't run into issues later. This also applies to integrations that +are calling Chocolatey and parsing output. Chocolatey **uses** +PowerShell, but it is an exe, so it cannot return PowerShell objects. + +Following these practices ensures both readability of your scripts AND +compatibility across different versions and editions of Chocolatey. +Following this guide will ensure your experience is not frustrating +based on choco not receiving things you think you are passing to it. + + * For consistency, always use `choco`, not `choco.exe`. Never use + shortcut commands like `cinst` or `cup`. + * Always have the command as the first argument to `choco. e.g. + [[`choco install`|Commandsinstall]], where [[`install`|Commandsinstall]] is the command. + * If there is a subcommand, ensure that is the second argument. e.g. + `choco source list`, where `source` is the command and [[`list`|Commandslist]] is the + subcommand. + * Typically the subject comes next. If installing packages, the + subject would be the package names, e.g. `choco install pkg1 pkg2`. + * Never use 'nupkg' or point directly to a nupkg file UNLESS using + 'choco push'. Use the source folder instead, e.g. `choco install + --source="'c:\folder\with\package'"` instead of + `choco install DoNotDoThis.1.0.nupkg` or `choco install DoNotDoThis + --source="'c:\folder\with\package\DoNotDoThis.1.0.nupkg'"`. + * Switches and parameters are called simply options. Options come + after the subject. e.g. `choco install pkg1 --debug --verbose`. + * Never use the force option (`--force`/`-f`) in scripts (or really + otherwise as a default mode of use). Force is an override on + Chocolatey behavior. If you are wondering why Chocolatey isn't doing + something like the documentation says it should, it's likely because + you are using force. Stop. + * Always use full option name. If the short option is `-n`, and the + full option is `--name`, use `--name`. The only acceptable short + option for use in scripts is `-y`. Find option names in help docs + online or through `choco -?` /`choco [Command Name] -?`. + * For scripts that are running automated, always use `-y`. Do note + that even with `-y` passed, some things / state issues detected will + temporarily stop for input - the key here is temporarily. They will + continue without requiring any action after the temporary timeout + (typically 30 seconds). + * Full option names are prepended with two dashes, e.g. `--` or + `--debug --verbose --ignore-proxy`. + * When setting a value to an option, always put an equals (`=`) + between the name and the setting, e.g. `--source="'local'"`. + * When setting a value to an option, always surround the value + properly with double quotes bookending apostrophes, e.g. + `--source="'internal_server'"`. + * If you are building PowerShell scripts, you can most likely just + simply use apostrophes surrounding option values, e.g. + `--source='internal_server'`. + * Prefer upgrade to install in scripts. You can't [[`install`|Commandsinstall]] to a newer + version of something, but you can [[`choco upgrade`|Commandsupgrade]] which will do both + upgrade or install (unless switched off explicitly). + * If you are sharing the script with others, pass `--source` to be + explicit about where the package is coming from. Use full link and + not source name ('https://chocolatey.org/api/v2' versus + 'chocolatey'). + * If parsing output, you might want to use `--limit-output`/`-r` to + get output in a more machine parseable format. **NOTE:** Not all + commands handle return of information in an easily digestible + output. + * Use exit codes to determine status. Chocolatey exits with 0 when + everything worked appropriately and other exits codes like 1 when + things error. There are package specific exit codes that are + recommended to be used and reboot indicating exit codes as well. To + check exit code when using PowerShell, immediately call + `$exitCode = $LASTEXITCODE` to get the value choco exited with. + +Here's an example following bad practices (line breaks added for + readability): + + `choco install pkg1 -y -params '/Option:Value /Option2:value with + spaces' --c4b-option 'Yaass' --option-that-is-new 'dude upgrade'` + +Now here is that example written with best practices (again line + breaks added for readability - there are not line continuations + for choco): + + `choco upgrade pkg1 -y --source="'https://chocolatey.org/api/v2'" + --package-parameters="'/Option:Value /Option2:value with spaces'" + --c4b-option="'Yaass'" --option-that-is-new="'dude upgrade'"` + +Note the differences between the two: + * Which is more self-documenting? + * Which will allow for the newest version of something installed or + upgraded to (which allows for more environmental consistency on + packages and versions)? + * Which may throw an error on a badly passed option? + * Which will throw errors on unknown option values? See explanation + below. + +Chocolatey ignores options it doesn't understand, but it can only + ignore option values if they are tied to the option with an + equals sign ('='). Note those last two options in the examples above? + If you roll off of a commercial edition or someone with older version + attempts to run the badly crafted script `--c4b-option 'Yaass' + --option-that-is-new 'dude upgrade'`, they are likely to see errors on + 'Yaass' and 'dude upgrade' because they are not explicitly tied to the + option they are written after. Now compare that to the other script. + Choco will ignore `--c4b-option="'Yaass'"` and + `--option-that-is-new="'dude upgrade'"` as a whole when it doesn't + register the options. This means that your script doesn't error. + +Following these scripting best practices will ensure your scripts work + everywhere they are used and with newer versions of Chocolatey. + + ## See Help Menu In Action ![choco help in action](https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/choco_help.gif) diff --git a/docs/generated/CommandsSearch.md b/docs/generated/CommandsSearch.md index 8de1d09f92..2b3f1120a8 100644 --- a/docs/generated/CommandsSearch.md +++ b/docs/generated/CommandsSearch.md @@ -23,9 +23,35 @@ Chocolatey will perform a search for a package local or remote. Some choco list -lai choco list --page=0 --page-size=25 choco search git - choco search git -s "'https://somewhere/out/there'" + choco search git --source="'https://somewhere/out/there'" choco search bob -s "'https://somewhere/protected'" -u user -p pass +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Enhanced: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + - 2: no results (enhanced) + +**NOTE:** Starting in v0.10.12, if you have the feature 'useEnhancedExitCodes' + turned on, then choco will provide enhanced exit codes that allow + better integration and scripting. + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + + ## See It In Action ![choco search](https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/choco_search.gif) diff --git a/docs/generated/CommandsSetapiKey.md b/docs/generated/CommandsSetapiKey.md index 6535ce5d6b..6fa0ff52f0 100644 --- a/docs/generated/CommandsSetapiKey.md +++ b/docs/generated/CommandsSetapiKey.md @@ -34,6 +34,9 @@ user name and password specified as 'user:password' for the API key. Please see your repository's documentation (for Nexus, please see https://bit.ly/nexus2apikey). +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + ## Connecting to Chocolatey.org (Community Package Repository) @@ -45,6 +48,19 @@ In order to save your API key for https://push.chocolatey.org/, choco apikey -k -s https://push.chocolatey.org/ +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + + ## Options and Switches **NOTE:** Options and switches apply to all items passed, so if you are @@ -162,6 +178,9 @@ Includes [[default options/switches|CommandsReference#default-options-and-switch this is either a key or it could be a user name and password specified as 'user:password'. + --rem, --remove + Removes an API key from Chocolatey + ~~~ [[Command Reference|CommandsReference]] diff --git a/docs/generated/CommandsSource.md b/docs/generated/CommandsSource.md index af4922dae4..c81fa15ac4 100644 --- a/docs/generated/CommandsSource.md +++ b/docs/generated/CommandsSource.md @@ -31,6 +31,22 @@ location. If it is a url, it will be a location you can go to in a browser and it returns OData with something that says Packages in the browser, similar to what you see when you go to https://chocolatey.org/api/v2/. +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + ## Options and Switches @@ -141,15 +157,15 @@ Includes [[default options/switches|CommandsReference#default-options-and-switch 0.8+. -n, --name=VALUE - Name - the name of the source. Required with some actions. Defaults to - empty. + Name - the name of the source. Required with actions other than list. + Defaults to empty. -s, --source=VALUE Source - The source. This can be a folder/file share or an http locatio- n. If it is a url, it will be a location you can go to in a browser and it returns OData with something that says Packages in the browser, similar to what you see when you go to https://chocolatey.org/api/v2/. - Defaults to empty. + Required with add action. Defaults to empty. -u, --user=VALUE User - used with authenticated feeds. Defaults to empty. diff --git a/docs/generated/CommandsSources.md b/docs/generated/CommandsSources.md index a1a495109b..5fc3630fd2 100644 --- a/docs/generated/CommandsSources.md +++ b/docs/generated/CommandsSources.md @@ -31,6 +31,22 @@ location. If it is a url, it will be a location you can go to in a browser and it returns OData with something that says Packages in the browser, similar to what you see when you go to https://chocolatey.org/api/v2/. +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + ## Options and Switches @@ -141,15 +157,15 @@ Includes [[default options/switches|CommandsReference#default-options-and-switch 0.8+. -n, --name=VALUE - Name - the name of the source. Required with some actions. Defaults to - empty. + Name - the name of the source. Required with actions other than list. + Defaults to empty. -s, --source=VALUE Source - The source. This can be a folder/file share or an http locatio- n. If it is a url, it will be a location you can go to in a browser and it returns OData with something that says Packages in the browser, similar to what you see when you go to https://chocolatey.org/api/v2/. - Defaults to empty. + Required with add action. Defaults to empty. -u, --user=VALUE User - used with authenticated feeds. Defaults to empty. diff --git a/docs/generated/CommandsUninstall.md b/docs/generated/CommandsUninstall.md index a1cbe25024..60b1764208 100644 --- a/docs/generated/CommandsUninstall.md +++ b/docs/generated/CommandsUninstall.md @@ -40,14 +40,14 @@ chocolatey without attempting to uninstall the program. choco feature disable -n autoUninstaller -**NOTE:** [Chocolatey Pro](https://chocolatey.org/compare) / Business automatically synchronizes with - Programs and Features, ensuring manually removed apps are +**NOTE:** [Chocolatey Pro](https://chocolatey.org/compare) / Business automatically synchronizes with + Programs and Features, ensuring manually removed apps are automatically removed from Chocolatey's repository. -**NOTE:** Synchronizer and AutoUninstaller enhancements in licensed - versions of Chocolatey ensure that Autouninstaller is up to 95% - effective at removing software without an uninstall script. This is - because synchronizer ensures the registry snapshot stays up to date +**NOTE:** Synchronizer and AutoUninstaller enhancements in licensed + versions of Chocolatey ensure that Autouninstaller is up to 95% + effective at removing software without an uninstall script. This is + because synchronizer ensures the registry snapshot stays up to date and licensed enhancements have the ability to inspect more locations to determine how to automatically uninstall software. @@ -73,6 +73,38 @@ chocolatey without attempting to uninstall the program. choco uninstall ruby --version 1.8.7.37402 choco uninstall nodejs.install --all-versions +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Package Exit Codes: + - 1605: software is not installed + - 1614: product is uninstalled + - 1641: success, reboot initiated + - 3010: success, reboot required + - other (not listed): likely an error has occurred + +In addition to normal exit codes, packages are allowed to exit + with their own codes when the feature 'usePackageExitCodes' is + turned on. Available in v0.9.10+. + +Reboot Exit Codes: + - 350: pending reboot detected, no action has occurred + - 1604: install suspended, incomplete + +In addition to the above exit codes, you may also see reboot exit codes + when the feature 'exitOnRebootDetected' is turned on. It typically requires + the feature 'usePackageExitCodes' to also be turned on to work properly. + Available in v0.10.12+. + ## Options and Switches **NOTE:** Options and switches apply to all items passed, so if you are @@ -267,6 +299,18 @@ Includes [[default options/switches|CommandsReference#default-options-and-switch Overrides the default feature 'stopOnFirstPackageFailure' set to 'False- '. Available in 0.10.4+. + --exitwhenrebootdetected, --exit-when-reboot-detected + Exit When Reboot Detected - Stop running install, upgrade, or uninstall + when a reboot request is detected. Requires 'usePackageExitCodes' + feature to be turned on. Will exit with either 350 or 1604. Overrides + the default feature 'exitOnRebootDetected' set to 'False'. Available in + 0.10.12+. + + --ignoredetectedreboot, --ignore-detected-reboot + Ignore Detected Reboot - Ignore any detected reboots if found. Overrides + the default feature 'exitOnRebootDetected' set to 'False'. Available in + 0.10.12+. + --fromprograms, --from-programs, --fromprogramsandfeatures, --from-programs-and-features From Programs and Features - Uninstalls a program from programs and features. Name used for id must be a match or a wildcard (*) to Display diff --git a/docs/generated/CommandsUpgrade.md b/docs/generated/CommandsUpgrade.md index 8ef65192cd..ef5fd2e66c 100644 --- a/docs/generated/CommandsUpgrade.md +++ b/docs/generated/CommandsUpgrade.md @@ -22,22 +22,57 @@ Upgrades a package or a list of packages. Some may prefer to use `cup` Skip upgrading certain packages with [[`choco pin`|Commandspin]] or with the option `--except`. -**NOTE:** [Chocolatey Pro](https://chocolatey.org/compare) / Business automatically synchronizes with +**NOTE:** [Chocolatey Pro](https://chocolatey.org/compare) / Business automatically synchronizes with Programs and Features, ensuring automatically updating apps' versions - (like Chrome) are up to date in Chocolatey's repository. + (like Chrome) are up to date in Chocolatey's repository. ## Examples choco upgrade chocolatey choco upgrade notepadplusplus googlechrome atom 7zip choco upgrade notepadplusplus googlechrome atom 7zip -dvfy - choco upgrade git --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'" -y + choco upgrade git -y --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'" + choco upgrade git -y --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'" --install-args="'/DIR=C:\git'" + # Params are package parameters, passed to the package + # Install args are installer arguments, appended to the silentArgs + # in the package for the installer itself choco upgrade nodejs.install --version 0.10.35 choco upgrade git -s "'https://somewhere/out/there'" choco upgrade git -s "'https://somewhere/protected'" -u user -p pass choco upgrade all choco upgrade all --except="'skype,conemu'" +**NOTE:** See scripting in [[how to pass arguments|CommandsReference#how-to-pass-options--switches]] (`choco -?`) for how to + write proper scripts and integrations. + + +## Exit Codes + +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +Package Exit Codes: + - 1641: success, reboot initiated + - 3010: success, reboot required + - other (not listed): likely an error has occurred + +In addition to normal exit codes, packages are allowed to exit + with their own codes when the feature 'usePackageExitCodes' is + turned on. Uninstall command has additional valid exit codes. + Available in v0.9.10+. + +Reboot Exit Codes: + - 350: pending reboot detected, no action has occurred + - 1604: install suspended, incomplete + +In addition to the above exit codes, you may also see reboot exit codes + when the feature 'exitOnRebootDetected' is turned on. It typically requires + the feature 'usePackageExitCodes' to also be turned on to work properly. + Available in v0.10.12+. + ## See It In Action ![choco upgrade](https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/choco_upgrade.gif) @@ -304,6 +339,19 @@ Includes [[default options/switches|CommandsReference#default-options-and-switch Overrides the default feature 'stopOnFirstPackageFailure' set to 'False- '. Available in 0.10.4+. + --skip-if-not-installed, --only-upgrade-installed, --skip-when-not-installed + Skip Packages Not Installed - if a package is not installed, do not + install it during the upgrade process. Overrides the default feature + 'skipPackageUpgradesWhenNotInstalled' set to 'False'. Available in 0.1- + 0.12+. + + --install-if-not-installed + Install Missing Packages When Not Installed - if a package is not + installed, install it as part of running upgrade (typically default + behavior). Overrides the default feature + 'skipPackageUpgradesWhenNotInstalled' set to 'False'. Available in 0.1- + 0.12+. + --exclude-pre, --exclude-prerelease, --exclude-prereleases Exclude Prerelease - Should prerelease be ignored for upgrades? Will be ignored if you pass `--pre`. Available in 0.10.4+. @@ -319,6 +367,18 @@ Includes [[default options/switches|CommandsReference#default-options-and-switch used during install for upgrade. Overrides the default feature 'useRememberedArgumentsForUpgrades' set to 'False'. Available in 0.10.4+. + --exitwhenrebootdetected, --exit-when-reboot-detected + Exit When Reboot Detected - Stop running install, upgrade, or uninstall + when a reboot request is detected. Requires 'usePackageExitCodes' + feature to be turned on. Will exit with either 350 or 1604. Overrides + the default feature 'exitOnRebootDetected' set to 'False'. Available in + 0.10.12+. + + --ignoredetectedreboot, --ignore-detected-reboot + Ignore Detected Reboot - Ignore any detected reboots if found. Overrides + the default feature 'exitOnRebootDetected' set to 'False'. Available in + 0.10.12+. + --sdc, --skipdownloadcache, --skip-download-cache Skip Download Cache - Use the original download even if a private CDN cache is available for a package. Overrides the default feature diff --git a/docs/generated/HelpersInstallChocolateyShortcut.md b/docs/generated/HelpersInstallChocolateyShortcut.md index 1bffe1a773..d6445106b1 100644 --- a/docs/generated/HelpersInstallChocolateyShortcut.md +++ b/docs/generated/HelpersInstallChocolateyShortcut.md @@ -60,7 +60,7 @@ Install-ChocolateyShortcut -ShortcutFilePath "C:\test.lnk" -TargetPath "C:\test. Install-ChocolateyShortcut ` -ShortcutFilePath "C:\notepad.lnk" ` -TargetPath "C:\Windows\System32\notepad.exe" ` - -WorkDirectory "C:\" ` + -WorkingDirectory "C:\" ` -Arguments "C:\test.txt" ` -IconLocation "C:\test.ico" ` -Description "This is the description" @@ -118,6 +118,9 @@ Accept Pipeline Input? | false OPTIONAL - The full absolute path of the Working Directory that will be used by the new shortcut. +As of v0.10.12, the directory will be created unless it contains environment +variable expansion like `%AppData%\FooBar`. + Property | Value ---------------------- | ----- Aliases | @@ -162,7 +165,7 @@ Default Value | Accept Pipeline Input? | false ### -WindowStyle [<Int32>] -OPTIONAL - Type of windows target application should open with. +OPTIONAL - Type of windows target application should open with. Available in 0.9.10+. 0 = Hidden, 1 = Normal Size, 3 = Maximized, 7 - Minimized. Full list table 3.9 here: https://technet.microsoft.com/en-us/library/ee156605.aspx From 096fc372acf7e21654c0ced1a49f9266331e9347 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 19:36:32 -0500 Subject: [PATCH 19/19] (doc) add exit codes to gen doc headings --- GenerateDocs.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GenerateDocs.ps1 b/GenerateDocs.ps1 index fd39dcfa08..a736cc996e 100644 --- a/GenerateDocs.ps1 +++ b/GenerateDocs.ps1 @@ -192,7 +192,7 @@ param( return } $commandText = $commandText -creplace '^(.+)(\s+Command\s*)$', "# `$1`$2 (choco $commandName)" - $commandText = $commandText -replace '^(Usage|Troubleshooting|Examples|Connecting to Chocolatey.org|See It In Action|Alternative Sources|Resources|Packages.config)', '## $1' + $commandText = $commandText -creplace '^(Usage|Troubleshooting|Examples|Exit Codes|Connecting to Chocolatey.org|See It In Action|Alternative Sources|Resources|Packages.config|Scripting \/ Integration - Best Practices \/ Style Guide)', '## $1' $commandText = $commandText -replace '^(Commands|How To Pass Options)', '## $1' $commandText = $commandText -replace '^(WebPI|Windows Features|Ruby|Cygwin|Python)\s*$', '### $1' $commandText = $commandText -replace 'NOTE\:', '**NOTE:**'