FontCommand.cpp (2680B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #include "pch.h" 4 #include "FontCommand.h" 5 #include "Workflows/CompletionFlow.h" 6 #include "Workflows/WorkflowBase.h" 7 #include "Workflows/FontFlow.h" 8 #include "Resources.h" 9 10 namespace AppInstaller::CLI 11 { 12 using namespace AppInstaller::CLI::Execution; 13 using namespace AppInstaller::CLI::Workflow; 14 using namespace AppInstaller::Utility::literals; 15 using namespace std::string_view_literals; 16 17 Utility::LocIndView s_FontCommand_HelpLink = "https://aka.ms/winget-command-font"_liv; 18 19 std::vector<std::unique_ptr<Command>> FontCommand::GetCommands() const 20 { 21 return InitializeFromMoveOnly<std::vector<std::unique_ptr<Command>>>({ 22 std::make_unique<FontListCommand>(FullName()), 23 }); 24 } 25 26 Resource::LocString FontCommand::ShortDescription() const 27 { 28 return { Resource::String::FontCommandShortDescription }; 29 } 30 31 Resource::LocString FontCommand::LongDescription() const 32 { 33 return { Resource::String::FontCommandLongDescription }; 34 } 35 36 Utility::LocIndView FontCommand::HelpLink() const 37 { 38 return s_FontCommand_HelpLink; 39 } 40 41 void FontCommand::ExecuteInternal(Execution::Context& context) const 42 { 43 OutputHelp(context.Reporter); 44 } 45 46 std::vector<Argument> FontListCommand::GetArguments() const 47 { 48 return { 49 Argument::ForType(Args::Type::Family), 50 Argument::ForType(Args::Type::Moniker), 51 Argument::ForType(Args::Type::Source), 52 Argument::ForType(Args::Type::Tag), 53 Argument::ForType(Args::Type::Exact), 54 Argument::ForType(Args::Type::AuthenticationMode), 55 Argument::ForType(Args::Type::AuthenticationAccount), 56 Argument::ForType(Args::Type::AcceptSourceAgreements), 57 }; 58 } 59 60 Resource::LocString FontListCommand::ShortDescription() const 61 { 62 return { Resource::String::FontListCommandShortDescription }; 63 } 64 65 Resource::LocString FontListCommand::LongDescription() const 66 { 67 return { Resource::String::FontListCommandLongDescription }; 68 } 69 70 void FontListCommand::Complete(Execution::Context& context, Args::Type valueType) const 71 { 72 UNREFERENCED_PARAMETER(valueType); 73 context.Reporter.Error() << Resource::String::PendingWorkError << std::endl; 74 THROW_HR(E_NOTIMPL); 75 } 76 77 Utility::LocIndView FontListCommand::HelpLink() const 78 { 79 return s_FontCommand_HelpLink; 80 } 81 82 void FontListCommand::ExecuteInternal(Execution::Context& context) const 83 { 84 context << Workflow::ReportInstalledFonts; 85 } 86 }