winget-cli

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

commit 70efd46ad29033cdbb86ac956619714989d2faee
parent fac5c11e4e9b275a5bdc93b916f7e725c2a8c939
Author: JohnMcPMS <johnmcp@microsoft.com>
Date:   Thu, 25 Jun 2020 18:04:10 -0700

Change how interactivity level arguments are chosen (#461)


Diffstat:
Msrc/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.cpp | 25+++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.cpp b/src/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.cpp @@ -65,17 +65,30 @@ namespace AppInstaller::CLI::Workflow const std::map<ManifestInstaller::InstallerSwitchType, Utility::NormalizedString>& installerSwitches = context.Get<Execution::Data::Installer>()->Switches; // Construct install experience arg. - if (context.Args.Contains(Execution::Args::Type::Silent) && installerSwitches.find(ManifestInstaller::InstallerSwitchType::Silent) != installerSwitches.end()) + // SilentWithProgress is default, so look for it first. + auto argsItr = installerSwitches.find(ManifestInstaller::InstallerSwitchType::SilentWithProgress); + + if (context.Args.Contains(Execution::Args::Type::Interactive)) { - installerArgs += installerSwitches.at(ManifestInstaller::InstallerSwitchType::Silent); + // If interacive requested, always use Interactive (or nothing). If the installer supports + // interactive it is usually the default, and thus it is cumbersome to put a blank entry in + // the manifest. + argsItr = installerSwitches.find(ManifestInstaller::InstallerSwitchType::Interactive); } - else if (context.Args.Contains(Execution::Args::Type::Interactive) && installerSwitches.find(ManifestInstaller::InstallerSwitchType::Interactive) != installerSwitches.end()) + // If no SilentWithProgress exists, or Silent requested, try to find Silent. + else if (argsItr == installerSwitches.end() || context.Args.Contains(Execution::Args::Type::Silent)) { - installerArgs += installerSwitches.at(ManifestInstaller::InstallerSwitchType::Interactive); + auto silentItr = installerSwitches.find(ManifestInstaller::InstallerSwitchType::Silent); + // If Silent requested, but doesn't exist, then continue using SilentWithProgress. + if (silentItr != installerSwitches.end()) + { + argsItr = silentItr; + } } - else if (installerSwitches.find(ManifestInstaller::InstallerSwitchType::SilentWithProgress) != installerSwitches.end()) + + if (argsItr != installerSwitches.end()) { - installerArgs += installerSwitches.at(ManifestInstaller::InstallerSwitchType::SilentWithProgress); + installerArgs += argsItr->second; } // Construct language arg if necessary.