winget-cli

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

commit babc5a429260b593a4c8a5aa10d66902ede25dbf
parent 43af2815d3ea1ac1b8234199fb00ad6d36ad0149
Author: Ryan Fu <69221034+ryfu-msft@users.noreply.github.com>
Date:   Thu,  2 Jun 2022 16:13:46 -0700

Display documentations in show command (#2212)


Diffstat:
Msrc/AppInstallerCLICore/Resources.h | 1+
Msrc/AppInstallerCLICore/Workflows/ShowFlow.cpp | 19++++++++++++++++++-
Msrc/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw | 3+++
3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/AppInstallerCLICore/Resources.h b/src/AppInstallerCLICore/Resources.h @@ -261,6 +261,7 @@ namespace AppInstaller::CLI::Resource WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelCopyrightUrl); WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelDependencies); WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelDescription); + WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelDocumentation); WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelExternalDependencies); WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelInstallationNotes); WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelInstaller); diff --git a/src/AppInstallerCLICore/Workflows/ShowFlow.cpp b/src/AppInstallerCLICore/Workflows/ShowFlow.cpp @@ -95,7 +95,24 @@ namespace AppInstaller::CLI::Workflow { info << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelInstallationNotes << ' ' << installationNotes << std::endl; } - auto agreements = manifest.CurrentLocalization.Get<Manifest::Localization::Agreements>(); + const auto& documentations = manifest.CurrentLocalization.Get<Manifest::Localization::Documentations>(); + if (!documentations.empty()) + { + context.Reporter.Info() << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelDocumentation << std::endl; + for (const auto& documentation : documentations) + { + if (!documentation.DocumentUrl.empty()) + { + if (!documentation.DocumentLabel.empty()) + { + info << Execution::ManifestInfoEmphasis << documentation.DocumentLabel << ": "_liv; + } + + info << documentation.DocumentUrl << std::endl; + } + } + } + const auto& agreements = manifest.CurrentLocalization.Get<Manifest::Localization::Agreements>(); if (!agreements.empty()) { context.Reporter.Info() << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelAgreements << std::endl; diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw @@ -1340,6 +1340,9 @@ Please specify one of them using the `--source` option to proceed.</value> <data name="RelatedLink" xml:space="preserve"> <value>Related Link</value> </data> + <data name="ShowLabelDocumentation" xml:space="preserve"> + <value>Documentation:</value> + </data> <data name="Notes" xml:space="preserve"> <value>Notes:</value> </data>