winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit c1a122e377e713b567f55d3864d1f1cf96f08aa8
parent 3f4645ae09be2c304f25e33a7642c65de432e897
Author: Ryan Fu <69221034+ryfu-msft@users.noreply.github.com>
Date:   Wed,  1 Jun 2022 15:20:06 -0700

add support for returnresponseurl (#2210)


Diffstat:
Msrc/AppInstallerCLICore/Resources.h | 1+
Msrc/AppInstallerCLICore/Workflows/InstallFlow.cpp | 9++++++++-
Msrc/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw | 3+++
Msrc/AppInstallerCLITests/TestData/InstallFlowTest_ExpectedReturnCodes.yaml | 3++-
Msrc/AppInstallerCLITests/WorkFlow.cpp | 1+
5 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/AppInstallerCLICore/Resources.h b/src/AppInstallerCLICore/Resources.h @@ -226,6 +226,7 @@ namespace AppInstaller::CLI::Resource WINGET_DEFINE_RESOURCE_STRINGID(PurgeInstallDirectory); WINGET_DEFINE_RESOURCE_STRINGID(QueryArgumentDescription); WINGET_DEFINE_RESOURCE_STRINGID(RainbowArgumentDescription); + WINGET_DEFINE_RESOURCE_STRINGID(RelatedLink); WINGET_DEFINE_RESOURCE_STRINGID(RenameArgumentDescription); WINGET_DEFINE_RESOURCE_STRINGID(ReparsePointsNotSupportedError); WINGET_DEFINE_RESOURCE_STRINGID(ReportIdentityFound); diff --git a/src/AppInstallerCLICore/Workflows/InstallFlow.cpp b/src/AppInstallerCLICore/Workflows/InstallFlow.cpp @@ -24,7 +24,7 @@ using namespace AppInstaller::Manifest; using namespace AppInstaller::Repository; using namespace AppInstaller::Settings; using namespace AppInstaller::Utility; - +using namespace AppInstaller::Utility::literals; namespace AppInstaller::CLI::Workflow { @@ -377,6 +377,13 @@ namespace AppInstaller::CLI::Workflow { auto returnCode = ExpectedReturnCode::GetExpectedReturnCode(expectedReturnCodeItr->second.ReturnResponseEnum); context.Reporter.Error() << returnCode.Message << std::endl; + + auto returnResponseUrl = expectedReturnCodeItr->second.ReturnResponseUrl; + if (!returnResponseUrl.empty()) + { + context.Reporter.Error() << Resource::String::RelatedLink << ": "_liv << returnResponseUrl << std::endl; + } + AICLI_TERMINATE_CONTEXT(returnCode.HResult); } diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw @@ -1337,4 +1337,7 @@ Please specify one of them using the `--source` option to proceed.</value> <data name="UnableToPurgeInstallDirectory" xml:space="preserve"> <value>Cannot purge install directory, as it was not created by WinGet</value> </data> + <data name="RelatedLink" xml:space="preserve"> + <value>Related Link</value> + </data> </root> \ No newline at end of file diff --git a/src/AppInstallerCLITests/TestData/InstallFlowTest_ExpectedReturnCodes.yaml b/src/AppInstallerCLITests/TestData/InstallFlowTest_ExpectedReturnCodes.yaml @@ -28,6 +28,7 @@ Installers: ReturnResponse: noNetwork - InstallerReturnCode: 8 ReturnResponse: contactSupport + ReturnResponseUrl: https://TestReturnResponseUrl - InstallerReturnCode: 9 ReturnResponse: rebootRequiredToFinish - InstallerReturnCode: 10 @@ -43,4 +44,4 @@ Installers: - InstallerReturnCode: 15 ReturnResponse: blockedByPolicy ManifestType: singleton -ManifestVersion: 1.1.0 +ManifestVersion: 1.2.0 diff --git a/src/AppInstallerCLITests/WorkFlow.cpp b/src/AppInstallerCLITests/WorkFlow.cpp @@ -814,6 +814,7 @@ TEST_CASE("InstallFlow_ExpectedReturnCodes", "[InstallFlow][workflow]") REQUIRE_TERMINATED_WITH(context, APPINSTALLER_CLI_ERROR_INSTALL_CONTACT_SUPPORT); REQUIRE(std::filesystem::exists(installResultPath.GetPath())); REQUIRE(installOutput.str().find(Resource::LocString(Resource::String::InstallFlowReturnCodeContactSupport).get()) != std::string::npos); + REQUIRE(installOutput.str().find("https://TestReturnResponseUrl") != std::string::npos); } TEST_CASE("InstallFlowWithNonApplicableArchitecture", "[InstallFlow][workflow]")