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

Add --ignore-warnings to Export command #4214

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/Commands/ExportCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace AppInstaller::CLI
Argument{ Execution::Args::Type::Source, Resource::String::ExportSourceArgumentDescription, ArgumentType::Standard },
Argument{ Execution::Args::Type::IncludeVersions, Resource::String::ExportIncludeVersionsArgumentDescription, ArgumentType::Flag },
Argument::ForType(Execution::Args::Type::AcceptSourceAgreements),
Argument::ForType(Execution::Args::Type::IgnoreWarnings),
};
}

Expand Down
16 changes: 12 additions & 4 deletions src/AppInstallerCLICore/Workflows/ImportExportFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ namespace AppInstaller::CLI::Workflow
bool checkVersion)
{
std::shared_ptr<IPackageVersionCollection> availableVersions = GetAvailableVersionsForInstalledVersion(package);
const bool suppressWarnings = context.Args.Contains(Execution::Args::Type::IgnoreWarnings);

if (!checkVersion)
{
Expand All @@ -86,7 +87,9 @@ namespace AppInstaller::CLI::Workflow
<< "Installed package version is not available."
<< " Package Id [" << availablePackageVersion->GetProperty(PackageVersionProperty::Id) << "], Version [" << version << "], Channel [" << channel << "]"
<< ". Found Version [" << availablePackageVersion->GetProperty(PackageVersionProperty::Version) << "], Channel [" << availablePackageVersion->GetProperty(PackageVersionProperty::Version) << "]");
context.Reporter.Warn() << Resource::String::InstalledPackageVersionNotAvailable(availablePackageVersion->GetProperty(PackageVersionProperty::Id), version, channel) << std::endl;
if (!suppressWarnings) {
context.Reporter.Warn() << Resource::String::InstalledPackageVersionNotAvailable(availablePackageVersion->GetProperty(PackageVersionProperty::Id), version, channel) << std::endl;
}
}
}

Expand All @@ -98,6 +101,7 @@ namespace AppInstaller::CLI::Workflow
{
const auto& searchResult = context.Get<Execution::Data::SearchResult>();
const bool includeVersions = context.Args.Contains(Execution::Args::Type::IncludeVersions);
const bool suppressWarnings = context.Args.Contains(Execution::Args::Type::IgnoreWarnings);
Trenly marked this conversation as resolved.
Show resolved Hide resolved
PackageCollection exportedPackages;
exportedPackages.ClientVersion = Runtime::GetClientVersion().get();
auto& exportedSources = exportedPackages.Sources;
Expand All @@ -113,7 +117,9 @@ namespace AppInstaller::CLI::Workflow
{
// Report package not found and move to next package.
AICLI_LOG(CLI, Warning, << "No available version of package [" << installedPackageVersion->GetProperty(PackageVersionProperty::Name) << "] was found to export");
context.Reporter.Warn() << Resource::String::InstalledPackageNotAvailable(installedPackageVersion->GetProperty(PackageVersionProperty::Name)) << std::endl;
if (!suppressWarnings) {
context.Reporter.Warn() << Resource::String::InstalledPackageNotAvailable(installedPackageVersion->GetProperty(PackageVersionProperty::Name)) << std::endl;
}
continue;
}

Expand All @@ -125,7 +131,9 @@ namespace AppInstaller::CLI::Workflow
{
// Report that the package requires accepting license terms
AICLI_LOG(CLI, Warning, << "Package [" << installedPackageVersion->GetProperty(PackageVersionProperty::Name) << "] requires license agreement to install");
context.Reporter.Warn() << Resource::String::ExportedPackageRequiresLicenseAgreement(installedPackageVersion->GetProperty(PackageVersionProperty::Name)) << std::endl;
if (!suppressWarnings) {
context.Reporter.Warn() << Resource::String::ExportedPackageRequiresLicenseAgreement(installedPackageVersion->GetProperty(PackageVersionProperty::Name)) << std::endl;
}
}

// Find the exported source for this package
Expand Down Expand Up @@ -233,7 +241,7 @@ namespace AppInstaller::CLI::Workflow
else
{
AICLI_LOG(CLI, Error, << "Missing required source: " << requiredSource.Details.Name);
context.Reporter.Warn()
context.Reporter.Error()
<< Resource::String::ImportSourceNotInstalled(Utility::LocIndView{ requiredSource.Details.Name })
<< std::endl;
AICLI_TERMINATE_CONTEXT(APPINSTALLER_CLI_ERROR_SOURCE_NAME_DOES_NOT_EXIST);
Expand Down
Loading