Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Release Notes to new line and indent #2312

Merged
merged 6 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/AppInstallerCLICore/Workflows/ShowFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

using namespace AppInstaller::Repository;
using namespace AppInstaller::CLI;
using namespace AppInstaller::Utility;
using namespace AppInstaller::Utility::literals;

namespace AppInstaller::CLI::Workflow
Expand Down Expand Up @@ -52,7 +53,7 @@ namespace AppInstaller::CLI::Workflow
}
if (!description.empty())
{
info << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelDescription << ' ' << description << std::endl;
ShowMultiLineField(info, Resource::String::ShowLabelDescription, description);
}
auto homepage = manifest.CurrentLocalization.Get<Manifest::Localization::PackageUrl>();
if (!homepage.empty())
Expand Down Expand Up @@ -83,7 +84,7 @@ namespace AppInstaller::CLI::Workflow
auto releaseNotes = manifest.CurrentLocalization.Get<Manifest::Localization::ReleaseNotes>();
if (!releaseNotes.empty())
{
info << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelReleaseNotes << ' ' << releaseNotes << std::endl;
ShowMultiLineField(info, Resource::String::ShowLabelReleaseNotes, releaseNotes);
}
auto releaseNotesUrl = manifest.CurrentLocalization.Get<Manifest::Localization::ReleaseNotesUrl>();
if (!releaseNotesUrl.empty())
Expand All @@ -93,7 +94,7 @@ namespace AppInstaller::CLI::Workflow
auto installationNotes = manifest.CurrentLocalization.Get<Manifest::Localization::InstallationNotes>();
if (!installationNotes.empty())
{
info << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelInstallationNotes << ' ' << installationNotes << std::endl;
ShowMultiLineField(info, Resource::String::ShowLabelInstallationNotes, installationNotes);
}
const auto& documentations = manifest.CurrentLocalization.Get<Manifest::Localization::Documentations>();
if (!documentations.empty())
Expand Down Expand Up @@ -245,4 +246,18 @@ namespace AppInstaller::CLI::Workflow
}
table.Complete();
}

void ShowMultiLineField(Execution::OutputStream& outputStream, StringResource::StringId label, std::string& value)
Trenly marked this conversation as resolved.
Show resolved Hide resolved
{
bool isMultiLine = FindAndReplace(value, "\n", "\n ");
outputStream << Execution::ManifestInfoEmphasis << label;
if (isMultiLine)
{
outputStream << std::endl << " "_liv << value << std::endl;
}
else
{
outputStream << ' ' << value << std::endl;
}
}
}
6 changes: 6 additions & 0 deletions src/AppInstallerCLICore/Workflows/ShowFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ namespace AppInstaller::CLI::Workflow
// Inputs: SearchResult [only operates on first match]
// Outputs: None
void ShowAppVersions(Execution::Context& context);

// Shows a manifest field, indenting if the field-value contains multiple lines
// Required Args: None
// Inputs: Label, Field Value
// Outputs: None
void ShowMultiLineField(Execution::OutputStream& outputStream, StringResource::StringId label, std::string& value);
}