-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add experimental feature for font list command (#4886)
- Loading branch information
Showing
32 changed files
with
763 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,7 @@ DUPLICATEALIAS | |
dustojnikhummer | ||
dvinns | ||
dwgs | ||
dwrite | ||
ecfr | ||
ecfrbrowse | ||
EFGH | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
#include "pch.h" | ||
#include "FontCommand.h" | ||
#include "Workflows/CompletionFlow.h" | ||
#include "Workflows/WorkflowBase.h" | ||
#include "Workflows/FontFlow.h" | ||
#include "Resources.h" | ||
|
||
namespace AppInstaller::CLI | ||
{ | ||
using namespace AppInstaller::CLI::Execution; | ||
using namespace AppInstaller::CLI::Workflow; | ||
using namespace AppInstaller::Utility::literals; | ||
using namespace std::string_view_literals; | ||
|
||
Utility::LocIndView s_FontCommand_HelpLink = "https://aka.ms/winget-command-font"_liv; | ||
|
||
std::vector<std::unique_ptr<Command>> FontCommand::GetCommands() const | ||
{ | ||
return InitializeFromMoveOnly<std::vector<std::unique_ptr<Command>>>({ | ||
std::make_unique<FontListCommand>(FullName()), | ||
}); | ||
} | ||
|
||
Resource::LocString FontCommand::ShortDescription() const | ||
{ | ||
return { Resource::String::FontCommandShortDescription }; | ||
} | ||
|
||
Resource::LocString FontCommand::LongDescription() const | ||
{ | ||
return { Resource::String::FontCommandLongDescription }; | ||
} | ||
|
||
Utility::LocIndView FontCommand::HelpLink() const | ||
{ | ||
return s_FontCommand_HelpLink; | ||
} | ||
|
||
void FontCommand::ExecuteInternal(Execution::Context& context) const | ||
{ | ||
OutputHelp(context.Reporter); | ||
} | ||
|
||
std::vector<Argument> FontListCommand::GetArguments() const | ||
{ | ||
return { | ||
Argument::ForType(Args::Type::Family), | ||
Argument::ForType(Args::Type::Moniker), | ||
Argument::ForType(Args::Type::Source), | ||
Argument::ForType(Args::Type::Tag), | ||
Argument::ForType(Args::Type::Exact), | ||
Argument::ForType(Args::Type::AuthenticationMode), | ||
Argument::ForType(Args::Type::AuthenticationAccount), | ||
Argument::ForType(Args::Type::AcceptSourceAgreements), | ||
}; | ||
} | ||
|
||
Resource::LocString FontListCommand::ShortDescription() const | ||
{ | ||
return { Resource::String::FontListCommandShortDescription }; | ||
} | ||
|
||
Resource::LocString FontListCommand::LongDescription() const | ||
{ | ||
return { Resource::String::FontListCommandLongDescription }; | ||
} | ||
|
||
void FontListCommand::Complete(Execution::Context& context, Args::Type valueType) const | ||
{ | ||
UNREFERENCED_PARAMETER(valueType); | ||
context.Reporter.Error() << Resource::String::PendingWorkError << std::endl; | ||
THROW_HR(E_NOTIMPL); | ||
} | ||
|
||
Utility::LocIndView FontListCommand::HelpLink() const | ||
{ | ||
return s_FontCommand_HelpLink; | ||
} | ||
|
||
void FontListCommand::ExecuteInternal(Execution::Context& context) const | ||
{ | ||
context << Workflow::ReportInstalledFonts; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
#pragma once | ||
#include "Command.h" | ||
#include <winget/UserSettings.h> | ||
|
||
namespace AppInstaller::CLI | ||
{ | ||
struct FontCommand final : public Command | ||
{ | ||
FontCommand(std::string_view parent) : Command("font", { "fonts" }, parent, Settings::ExperimentalFeature::Feature::Font) {} | ||
|
||
std::vector<std::unique_ptr<Command>> GetCommands() const override; | ||
|
||
Resource::LocString ShortDescription() const override; | ||
Resource::LocString LongDescription() const override; | ||
|
||
Utility::LocIndView HelpLink() const override; | ||
|
||
protected: | ||
void ExecuteInternal(Execution::Context& context) const override; | ||
}; | ||
|
||
struct FontListCommand final : public Command | ||
{ | ||
FontListCommand(std::string_view parent) : Command("list", parent) {} | ||
|
||
std::vector<Argument> GetArguments() const override; | ||
|
||
Resource::LocString ShortDescription() const override; | ||
Resource::LocString LongDescription() const override; | ||
|
||
void Complete(Execution::Context& context, Execution::Args::Type valueType) const override; | ||
|
||
Utility::LocIndView HelpLink() const override; | ||
|
||
protected: | ||
void ExecuteInternal(Execution::Context& context) const override; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.