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

Added system architecture to winget --info. #1937

Merged
merged 5 commits into from
Feb 24, 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: 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
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