From 3c5afc5a1a87f8282c8b1fdf917a18fc308a61c5 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 14 Mar 2019 16:20:43 -0500 Subject: [PATCH] (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