ImportCommand.cpp (2330B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #include "pch.h" 4 #include "ImportCommand.h" 5 #include "Workflows/DownloadFlow.h" 6 #include "Workflows/CompletionFlow.h" 7 #include "Workflows/ImportExportFlow.h" 8 #include "Workflows/MultiQueryFlow.h" 9 #include "Workflows/WorkflowBase.h" 10 #include "Resources.h" 11 12 namespace AppInstaller::CLI 13 { 14 using namespace std::string_view_literals; 15 16 std::vector<Argument> ImportCommand::GetArguments() const 17 { 18 return { 19 Argument{ Execution::Args::Type::ImportFile, Resource::String::ImportFileArgumentDescription, ArgumentType::Positional, true }, 20 Argument{ Execution::Args::Type::IgnoreUnavailable, Resource::String::ImportIgnoreUnavailableArgumentDescription, ArgumentType::Flag }, 21 Argument{ Execution::Args::Type::IgnoreVersions, Resource::String::ImportIgnorePackageVersionsArgumentDescription, ArgumentType::Flag }, 22 Argument::ForType(Execution::Args::Type::NoUpgrade), 23 Argument::ForType(Execution::Args::Type::AcceptPackageAgreements), 24 Argument::ForType(Execution::Args::Type::AcceptSourceAgreements), 25 }; 26 } 27 28 Resource::LocString ImportCommand::ShortDescription() const 29 { 30 return { Resource::String::ImportCommandShortDescription }; 31 } 32 33 Resource::LocString ImportCommand::LongDescription() const 34 { 35 return { Resource::String::ImportCommandLongDescription }; 36 } 37 38 Utility::LocIndView ImportCommand::HelpLink() const 39 { 40 return "https://aka.ms/winget-command-import"_liv; 41 } 42 43 void ImportCommand::ExecuteInternal(Execution::Context& context) const 44 { 45 context << 46 Workflow::InitializeInstallerDownloadAuthenticatorsMap << 47 Workflow::ReportExecutionStage(Workflow::ExecutionStage::Discovery) << 48 Workflow::VerifyFile(Execution::Args::Type::ImportFile) << 49 Workflow::ReadImportFile << 50 Workflow::OpenSourcesForImport << 51 Workflow::OpenPredefinedSource(Repository::PredefinedSource::Installed) << 52 Workflow::GetSearchRequestsForImport << 53 Workflow::SearchSubContextsForSingle() << 54 Workflow::ReportExecutionStage(Workflow::ExecutionStage::Execution) << 55 Workflow::InstallImportedPackages; 56 } 57 }