commit 995a95d9b2e56ddffcde0e3722d8f2e3c468a367
parent e2d7202993f5e61ebab758e95aa9ef94da566ffb
Author: Kaleb Luedtke <trenlymc@gmail.com>
Date: Wed, 24 Jan 2024 20:12:54 -0600
Show only agreement related info during install (#3999)
This PR cleans up the install flow to make it easier for a user to see
the agreements of the package. It does this by changing the install flow
to not show fields that are unrelated to package agreements such as
- Moniker
- Description
- PackageUrl
- ReleaseNotes
- ReleaseNotesUrl
- InstallationNotes
- Documentations
- Tags
Co-authored-by: yao-msft <50888816+yao-msft@users.noreply.github.com>
Diffstat:
3 files changed, 55 insertions(+), 25 deletions(-)
diff --git a/src/AppInstallerCLICore/Workflows/PromptFlow.cpp b/src/AppInstallerCLICore/Workflows/PromptFlow.cpp
@@ -178,7 +178,7 @@ namespace AppInstaller::CLI::Workflow
return;
}
- context << Workflow::ReportManifestIdentityWithVersion(Resource::String::ReportIdentityForAgreements) << Workflow::ShowPackageInfo;
+ context << Workflow::ReportManifestIdentityWithVersion(Resource::String::ReportIdentityForAgreements) << Workflow::ShowAgreementsInfo;
context.Reporter.EmptyLine();
}
diff --git a/src/AppInstallerCLICore/Workflows/ShowFlow.cpp b/src/AppInstallerCLICore/Workflows/ShowFlow.cpp
@@ -65,10 +65,57 @@ namespace {
outputStream << " "_liv << value << std::endl;
}
}
+
+ void ShowAgreements(Execution::OutputStream outputStream, const std::vector<AppInstaller::Manifest::Agreement>& agreements) {
+
+ if (agreements.empty()) {
+ return;
+ }
+
+ outputStream << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelAgreements << std::endl;
+ for (const auto& agreement : agreements) {
+
+ if (!agreement.Label.empty())
+ {
+ outputStream << " "_liv << Execution::ManifestInfoEmphasis << agreement.Label << ": "_liv;
+ }
+
+ if (!agreement.AgreementText.empty())
+ {
+ outputStream << agreement.AgreementText << std::endl;
+ }
+
+ if (!agreement.AgreementUrl.empty())
+ {
+ outputStream << agreement.AgreementUrl << std::endl;
+ }
+ }
+ }
}
namespace AppInstaller::CLI::Workflow
{
+ void ShowAgreementsInfo(Execution::Context& context)
+ {
+ const auto& manifest = context.Get<Execution::Data::Manifest>();
+ auto info = context.Reporter.Info();
+
+ ShowSingleLineField(info, Resource::String::ShowLabelVersion, manifest.Version);
+ ShowSingleLineField(info, Resource::String::ShowLabelPublisher, manifest.CurrentLocalization.Get<Manifest::Localization::Publisher>());
+ ShowSingleLineField(info, Resource::String::ShowLabelPublisherUrl, manifest.CurrentLocalization.Get<Manifest::Localization::PublisherUrl>());
+ ShowSingleLineField(info, Resource::String::ShowLabelPublisherSupportUrl, manifest.CurrentLocalization.Get<Manifest::Localization::PublisherSupportUrl>());
+ ShowSingleLineField(info, Resource::String::ShowLabelAuthor, manifest.CurrentLocalization.Get<Manifest::Localization::Author>());
+ ShowSingleLineField(info, Resource::String::ShowLabelPackageUrl, manifest.CurrentLocalization.Get<Manifest::Localization::PackageUrl>());
+ ShowSingleLineField(info, Resource::String::ShowLabelLicense, manifest.CurrentLocalization.Get<Manifest::Localization::License>());
+ ShowSingleLineField(info, Resource::String::ShowLabelLicenseUrl, manifest.CurrentLocalization.Get<Manifest::Localization::LicenseUrl>());
+ ShowSingleLineField(info, Resource::String::ShowLabelPrivacyUrl, manifest.CurrentLocalization.Get<Manifest::Localization::PrivacyUrl>());
+ ShowSingleLineField(info, Resource::String::ShowLabelCopyright, manifest.CurrentLocalization.Get<Manifest::Localization::Copyright>());
+ ShowSingleLineField(info, Resource::String::ShowLabelCopyrightUrl, manifest.CurrentLocalization.Get<Manifest::Localization::CopyrightUrl>());
+ ShowSingleLineField(info, Resource::String::ShowLabelPurchaseUrl, manifest.CurrentLocalization.Get<Manifest::Localization::PurchaseUrl>());
+ ShowAgreements(info, manifest.CurrentLocalization.Get<Manifest::Localization::Agreements>());
+
+ }
+
void ShowManifestInfo(Execution::Context& context)
{
context << ShowPackageInfo << ShowInstallerInfo;
@@ -118,30 +165,7 @@ namespace AppInstaller::CLI::Workflow
}
}
ShowMultiValueField(info, Resource::String::ShowLabelTags, manifest.CurrentLocalization.Get<Manifest::Localization::Tags>());
- const auto& agreements = manifest.CurrentLocalization.Get<Manifest::Localization::Agreements>();
- if (!agreements.empty())
- {
- context.Reporter.Info() << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelAgreements << std::endl;
- for (const auto& agreement : agreements)
- {
- if (!agreement.Label.empty())
- {
- info << Execution::ManifestInfoEmphasis << agreement.Label << ": "_liv;
- }
-
- if (!agreement.AgreementText.empty())
- {
- info << agreement.AgreementText << std::endl;
- }
-
- if (!agreement.AgreementUrl.empty())
- {
- info << agreement.AgreementUrl << std::endl;
- }
- }
-
- info << std::endl;
- }
+ ShowAgreements(info, manifest.CurrentLocalization.Get<Manifest::Localization::Agreements>());
}
void ShowInstallerInfo(Execution::Context& context)
diff --git a/src/AppInstallerCLICore/Workflows/ShowFlow.h b/src/AppInstallerCLICore/Workflows/ShowFlow.h
@@ -5,6 +5,12 @@
namespace AppInstaller::CLI::Workflow
{
+ // Shows information on an application; this is only the information for package agreements
+ // Required Args: None
+ // Inputs: Manifest
+ // Outputs: None
+ void ShowAgreementsInfo(Execution::Context& context);
+
// Shows information on an application.
// Required Args: None
// Inputs: Manifest, Installer