winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 015c9e32fdfe9d28bc99fe7f6a35f1fc1f239a54
parent a80d3398e3001f1bd01a3d28205924dac7b6f164
Author: Easton Pillay <easton@planeteaston.com>
Date:   Thu, 24 Feb 2022 00:15:10 -0600

Added system architecture to `winget --info`. (#1937)


Diffstat:
Msrc/AppInstallerCLICore/Commands/RootCommand.cpp | 2++
Msrc/AppInstallerCLICore/Resources.h | 1+
Msrc/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw | 3+++
Msrc/AppInstallerCommonCore/Architecture.cpp | 15++++++++-------
Msrc/AppInstallerCommonCore/Public/AppInstallerArchitecture.h | 3++-
5 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/AppInstallerCLICore/Commands/RootCommand.cpp b/src/AppInstallerCLICore/Commands/RootCommand.cpp @@ -173,6 +173,8 @@ namespace AppInstaller::CLI info << std::endl << "Windows: "_liv << Runtime::GetOSVersion() << std::endl; + info << Resource::String::SystemArchitecture << ": "_liv << Utility::ToString(Utility::GetSystemArchitecture()) << std::endl; + if (Runtime::IsRunningInPackagedContext()) { info << Resource::String::Package << ": "_liv << Runtime::GetPackageVersion() << std::endl; diff --git a/src/AppInstallerCLICore/Resources.h b/src/AppInstallerCLICore/Resources.h @@ -318,6 +318,7 @@ namespace AppInstaller::CLI::Resource WINGET_DEFINE_RESOURCE_STRINGID(SourceUpdateCommandLongDescription); WINGET_DEFINE_RESOURCE_STRINGID(SourceUpdateCommandShortDescription); WINGET_DEFINE_RESOURCE_STRINGID(SourceUpdateOne); + WINGET_DEFINE_RESOURCE_STRINGID(SystemArchitecture); WINGET_DEFINE_RESOURCE_STRINGID(TagArgumentDescription); WINGET_DEFINE_RESOURCE_STRINGID(ThankYou); WINGET_DEFINE_RESOURCE_STRINGID(ThirdPartSoftwareNotices); diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw @@ -1272,4 +1272,7 @@ Please specify one of them using the `--source` option to proceed.</value> <data name="InvalidArgumentWithoutQueryError" xml:space="preserve"> <value>The arguments provided can only be used with a query.</value> </data> + <data name="SystemArchitecture" xml:space="preserve"> + <value>System Architecture</value> + </data> </root> \ No newline at end of file diff --git a/src/AppInstallerCommonCore/Architecture.cpp b/src/AppInstallerCommonCore/Architecture.cpp @@ -8,6 +8,7 @@ namespace AppInstaller::Utility { + using namespace literals; namespace { // IsWow64GuestMachineSupported() is available starting on Windows 10, version 1709 (RS3). @@ -186,23 +187,23 @@ namespace AppInstaller::Utility return Architecture::Unknown; } - std::string_view ToString(Architecture architecture) + LocIndView ToString(Architecture architecture) { switch (architecture) { case Architecture::Neutral: - return "Neutral"sv; + return "Neutral"_liv; case Architecture::X86: - return "X86"sv; + return "X86"_liv; case Architecture::X64: - return "X64"sv; + return "X64"_liv; case Architecture::Arm: - return "Arm"sv; + return "Arm"_liv; case Architecture::Arm64: - return "Arm64"sv; + return "Arm64"_liv; } - return "Unknown"sv; + return "Unknown"_liv; } Architecture GetSystemArchitecture() diff --git a/src/AppInstallerCommonCore/Public/AppInstallerArchitecture.h b/src/AppInstallerCommonCore/Public/AppInstallerArchitecture.h @@ -3,6 +3,7 @@ #pragma once #include <vector> +#include <winget/LocIndependent.h> namespace AppInstaller::Utility { @@ -22,7 +23,7 @@ namespace AppInstaller::Utility Architecture ConvertToArchitectureEnum(const std::string& archStr); // Converts an Architecture to a string_view - std::string_view ToString(Architecture architecture); + LocIndView ToString(Architecture architecture); // Gets the system's architecture as Architecture enum AppInstaller::Utility::Architecture GetSystemArchitecture();