Skip to content

Commit

Permalink
Added system architecture to winget --info. (microsoft#1937)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedieaston authored Feb 24, 2022
1 parent a80d339 commit 015c9e3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/AppInstallerCLICore/Commands/RootCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
Original file line number Diff line number Diff line change
Expand Up @@ -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>
15 changes: 8 additions & 7 deletions src/AppInstallerCommonCore/Architecture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace AppInstaller::Utility
{
using namespace literals;
namespace
{
// IsWow64GuestMachineSupported() is available starting on Windows 10, version 1709 (RS3).
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion src/AppInstallerCommonCore/Public/AppInstallerArchitecture.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma once

#include <vector>
#include <winget/LocIndependent.h>

namespace AppInstaller::Utility
{
Expand All @@ -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();
Expand Down

0 comments on commit 015c9e3

Please sign in to comment.