commit cab941a8c458ca8b8685bd359c504f3e15ef1d06
parent 48b8303521a8394c06c476056d8acbaba4be16af
Author: Flex Zhong <chungzh07@gmail.com>
Date: Mon, 23 Aug 2021 11:26:19 +0800
Display count of available upgrades (#1390)
Diffstat:
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/AppInstallerCLICore/Resources.h b/src/AppInstallerCLICore/Resources.h
@@ -27,6 +27,7 @@ namespace AppInstaller::CLI::Resource
WINGET_DEFINE_RESOURCE_STRINGID(AvailableHeader);
WINGET_DEFINE_RESOURCE_STRINGID(AvailableOptions);
WINGET_DEFINE_RESOURCE_STRINGID(AvailableSubcommands);
+ WINGET_DEFINE_RESOURCE_STRINGID(AvailableUpgrades);
WINGET_DEFINE_RESOURCE_STRINGID(BothManifestAndSearchQueryProvided);
WINGET_DEFINE_RESOURCE_STRINGID(Cancelled);
WINGET_DEFINE_RESOURCE_STRINGID(ChannelArgumentDescription);
diff --git a/src/AppInstallerCLICore/Workflows/WorkflowBase.cpp b/src/AppInstallerCLICore/Workflows/WorkflowBase.cpp
@@ -446,6 +446,8 @@ namespace AppInstaller::CLI::Workflow
Resource::String::SearchSource
});
+ int availableUpgradesCount = 0;
+
for (const auto& match : searchResult.Matches)
{
auto installedVersion = match.Package->GetInstalledVersion();
@@ -464,6 +466,7 @@ namespace AppInstaller::CLI::Workflow
{
availableVersion = latestVersion->GetProperty(PackageVersionProperty::Version);
sourceName = latestVersion->GetProperty(PackageVersionProperty::SourceName);
+ availableUpgradesCount++;
}
table.OutputLine({
@@ -482,6 +485,8 @@ namespace AppInstaller::CLI::Workflow
if (table.IsEmpty())
{
context.Reporter.Info() << Resource::String::NoInstalledPackageFound << std::endl;
+ } else if (m_onlyShowUpgrades) {
+ context.Reporter.Info() << availableUpgradesCount << ' ' << Resource::String::AvailableUpgrades << std::endl;
}
if (searchResult.Truncated)
diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
@@ -141,6 +141,9 @@
<value>The following sub-commands are available:</value>
<comment>Nested commands that can be run in context of the selected command</comment>
</data>
+ <data name="AvailableUpgrades" xml:space="preserve">
+ <value>upgrades available.</value>
+ </data>
<data name="ChannelArgumentDescription" xml:space="preserve">
<value>Use the specified channel; default is general audience</value>
</data>
@@ -1016,4 +1019,4 @@ Do you agree to the terms?</value>
<data name="PromptOptionYes" xml:space="preserve">
<value>Yes</value>
</data>
-</root>-
\ No newline at end of file
+</root>