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

Return localization independent string for help links #2786

Merged
merged 3 commits into from
Dec 20, 2022
Merged
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
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ namespace AppInstaller::CLI
}

// Finally, the link to the documentation pages
auto helpLink = Utility::LocIndString{ HelpLink() };
auto helpLink = HelpLink();
if (!helpLink.empty())
{
infoOut << std::endl << Resource::String::HelpLinkPreamble(helpLink) << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace AppInstaller::CLI

virtual void OutputIntroHeader(Execution::Reporter& reporter) const;
virtual void OutputHelp(Execution::Reporter& reporter, const CommandException* exception = nullptr) const;
virtual std::string HelpLink() const { return {}; }
virtual Utility::LocIndView HelpLink() const { return {}; }

virtual std::unique_ptr<Command> FindSubCommand(Invocation& inv) const;
virtual void ParseArguments(Invocation& inv, Execution::Args& execArgs) const;
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/CompleteCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ namespace AppInstaller::CLI
return { Resource::String::CompleteCommandLongDescription };
}

std::string CompleteCommand::HelpLink() const
Utility::LocIndView CompleteCommand::HelpLink() const
{
return "https://aka.ms/winget-command-complete";
return "https://aka.ms/winget-command-complete"_liv;
}

void CompleteCommand::ExecuteInternal(Execution::Context& context) const
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/CompleteCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace AppInstaller::CLI
Resource::LocString ShortDescription() const override;
Resource::LocString LongDescription() const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/ExperimentalCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ namespace AppInstaller::CLI
return { Resource::String::ExperimentalCommandLongDescription };
}

std::string ExperimentalCommand::HelpLink() const
Utility::LocIndView ExperimentalCommand::HelpLink() const
{
return "https://aka.ms/winget-settings";
return "https://aka.ms/winget-settings"_liv;
}

void ExperimentalCommand::ExecuteInternal(Execution::Context& context) const
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/ExperimentalCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace AppInstaller::CLI
virtual Resource::LocString ShortDescription() const override;
virtual Resource::LocString LongDescription() const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/ExportCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ namespace AppInstaller::CLI
}
}

std::string ExportCommand::HelpLink() const
Utility::LocIndView ExportCommand::HelpLink() const
{
return "https://aka.ms/winget-command-export";
return "https://aka.ms/winget-command-export"_liv;
}

void ExportCommand::ExecuteInternal(Execution::Context& context) const
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/ExportCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace AppInstaller::CLI

void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/FeaturesCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ namespace AppInstaller::CLI
return { Resource::String::FeaturesCommandLongDescription };
}

std::string FeaturesCommand::HelpLink() const
Utility::LocIndView FeaturesCommand::HelpLink() const
{
return "https://aka.ms/winget-experimentalfeatures";
return "https://aka.ms/winget-experimentalfeatures"_liv;
}

void FeaturesCommand::ExecuteInternal(Execution::Context& context) const
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/FeaturesCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace AppInstaller::CLI
virtual Resource::LocString ShortDescription() const override;
virtual Resource::LocString LongDescription() const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/HashCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ namespace AppInstaller::CLI
return { Resource::String::HashCommandLongDescription };
}

std::string HashCommand::HelpLink() const
Utility::LocIndView HashCommand::HelpLink() const
{
return "https://aka.ms/winget-command-hash";
return "https://aka.ms/winget-command-hash"_liv;
}

void HashCommand::ExecuteInternal(Execution::Context& context) const
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/HashCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace AppInstaller::CLI
virtual Resource::LocString ShortDescription() const override;
virtual Resource::LocString LongDescription() const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/ImportCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ namespace AppInstaller::CLI
return { Resource::String::ImportCommandLongDescription };
}

std::string ImportCommand::HelpLink() const
Utility::LocIndView ImportCommand::HelpLink() const
{
return "https://aka.ms/winget-command-import";
return "https://aka.ms/winget-command-import"_liv;
}

void ImportCommand::ExecuteInternal(Execution::Context& context) const
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/ImportCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace AppInstaller::CLI
Resource::LocString ShortDescription() const override;
Resource::LocString LongDescription() const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/InstallCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ namespace AppInstaller::CLI
}
}

std::string InstallCommand::HelpLink() const
Utility::LocIndView InstallCommand::HelpLink() const
{
return "https://aka.ms/winget-command-install";
return "https://aka.ms/winget-command-install"_liv;
}

void InstallCommand::ValidateArgumentsInternal(Args& execArgs) const
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/InstallCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace AppInstaller::CLI

void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ValidateArgumentsInternal(Execution::Args& execArgs) const override;
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/ListCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ namespace AppInstaller::CLI
}
}

std::string ListCommand::HelpLink() const
Utility::LocIndView ListCommand::HelpLink() const
{
return "https://aka.ms/winget-command-list";
return "https://aka.ms/winget-command-list"_liv;
}

void ListCommand::ExecuteInternal(Execution::Context& context) const
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/ListCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace AppInstaller::CLI

void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand Down
22 changes: 11 additions & 11 deletions src/AppInstallerCLICore/Commands/PinCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace AppInstaller::CLI
using namespace AppInstaller::Utility::literals;
using namespace std::string_view_literals;

static constexpr std::string_view s_PinCommand_HelpLink = "https://aka.ms/winget-command-pin"sv;
Utility::LocIndView s_PinCommand_HelpLink = "https://aka.ms/winget-command-pin"_liv;

std::vector<std::unique_ptr<Command>> PinCommand::GetCommands() const
{
Expand All @@ -35,9 +35,9 @@ namespace AppInstaller::CLI
return { Resource::String::PinCommandLongDescription };
}

std::string PinCommand::HelpLink() const
Utility::LocIndView PinCommand::HelpLink() const
{
return std::string{ s_PinCommand_HelpLink };
return s_PinCommand_HelpLink;
}

void PinCommand::ExecuteInternal(Execution::Context& context) const
Expand Down Expand Up @@ -89,9 +89,9 @@ namespace AppInstaller::CLI
}
}

std::string PinAddCommand::HelpLink() const
Utility::LocIndView PinAddCommand::HelpLink() const
{
return std::string{ s_PinCommand_HelpLink };
return s_PinCommand_HelpLink;
}

void PinAddCommand::ValidateArgumentsInternal(Execution::Args& execArgs) const
Expand Down Expand Up @@ -150,9 +150,9 @@ namespace AppInstaller::CLI
}
}

std::string PinRemoveCommand::HelpLink() const
Utility::LocIndView PinRemoveCommand::HelpLink() const
{
return std::string{ s_PinCommand_HelpLink };
return s_PinCommand_HelpLink;
}

void PinRemoveCommand::ExecuteInternal(Execution::Context& context) const
Expand Down Expand Up @@ -202,9 +202,9 @@ namespace AppInstaller::CLI
}
}

std::string PinListCommand::HelpLink() const
Utility::LocIndView PinListCommand::HelpLink() const
{
return std::string{ s_PinCommand_HelpLink };
return s_PinCommand_HelpLink;
}

void PinListCommand::ExecuteInternal(Execution::Context& context) const
Expand All @@ -230,9 +230,9 @@ namespace AppInstaller::CLI
return { Resource::String::PinResetCommandLongDescription };
}

std::string PinResetCommand::HelpLink() const
Utility::LocIndView PinResetCommand::HelpLink() const
{
return std::string{ s_PinCommand_HelpLink };
return s_PinCommand_HelpLink;
}

void PinResetCommand::ExecuteInternal(Execution::Context& context) const
Expand Down
10 changes: 5 additions & 5 deletions src/AppInstallerCLICore/Commands/PinCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace AppInstaller::CLI
Resource::LocString ShortDescription() const override;
Resource::LocString LongDescription() const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand All @@ -32,7 +32,7 @@ namespace AppInstaller::CLI

void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ValidateArgumentsInternal(Execution::Args& execArgs) const override;
Expand All @@ -50,7 +50,7 @@ namespace AppInstaller::CLI

void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand All @@ -67,7 +67,7 @@ namespace AppInstaller::CLI

void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand All @@ -82,7 +82,7 @@ namespace AppInstaller::CLI
Resource::LocString ShortDescription() const override;
Resource::LocString LongDescription() const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/RootCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ namespace AppInstaller::CLI
return { Resource::String::ToolDescription };
}

std::string RootCommand::HelpLink() const
Utility::LocIndView RootCommand::HelpLink() const
{
return "https://aka.ms/winget-command-help";
return "https://aka.ms/winget-command-help"_liv;
}

void RootCommand::Execute(Execution::Context& context) const
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/RootCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace AppInstaller::CLI

Resource::LocString LongDescription() const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

void Execute(Execution::Context& context) const override;

Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/SearchCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ namespace AppInstaller::CLI
}
}

std::string SearchCommand::HelpLink() const
Utility::LocIndView SearchCommand::HelpLink() const
{
return "https://aka.ms/winget-command-search";
return "https://aka.ms/winget-command-search"_liv;
}

void SearchCommand::ValidateArgumentsInternal(Args& execArgs) const
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/SearchCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace AppInstaller::CLI

void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ValidateArgumentsInternal(Execution::Args& execArgs) const override;
Expand Down
10 changes: 5 additions & 5 deletions src/AppInstallerCLICore/Commands/SettingsCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace AppInstaller::CLI
constexpr Utility::LocIndView s_ArgumentName_Enable = "enable"_liv;
constexpr Utility::LocIndView s_ArgumentName_Disable = "disable"_liv;
constexpr Utility::LocIndView s_ArgName_EnableAndDisable = "enable|disable"_liv;
static constexpr std::string_view s_SettingsCommand_HelpLink = "https://aka.ms/winget-settings"sv;
Utility::LocIndView s_SettingsCommand_HelpLink = "https://aka.ms/winget-settings"_liv;
}

std::vector<std::unique_ptr<Command>> SettingsCommand::GetCommands() const
Expand Down Expand Up @@ -44,9 +44,9 @@ namespace AppInstaller::CLI
return { Resource::String::SettingsCommandLongDescription };
}

std::string SettingsCommand::HelpLink() const
Utility::LocIndView SettingsCommand::HelpLink() const
{
return std::string{ s_SettingsCommand_HelpLink };
return s_SettingsCommand_HelpLink;
}

void SettingsCommand::ValidateArgumentsInternal(Execution::Args& execArgs) const
Expand Down Expand Up @@ -108,9 +108,9 @@ namespace AppInstaller::CLI
return { Resource::String::SettingsExportCommandLongDescription };
}

std::string SettingsExportCommand::HelpLink() const
Utility::LocIndView SettingsExportCommand::HelpLink() const
{
return std::string{ s_SettingsCommand_HelpLink };
return s_SettingsCommand_HelpLink;
}

void SettingsExportCommand::ExecuteInternal(Execution::Context& context) const
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/SettingsCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace AppInstaller::CLI
virtual Resource::LocString ShortDescription() const override;
virtual Resource::LocString LongDescription() const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ValidateArgumentsInternal(Execution::Args& execArgs) const override;
Expand All @@ -29,7 +29,7 @@ namespace AppInstaller::CLI
Resource::LocString ShortDescription() const override;
Resource::LocString LongDescription() const override;

std::string HelpLink() const override;
Utility::LocIndView HelpLink() const override;

protected:
void ExecuteInternal(Execution::Context& context) const override;
Expand Down
Loading