winget-cli

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

commit 88a69d85f73a2f28adaa4e5780cb159201ff8f10
parent fee797bb5a51238e0b37b9590ee12d4f1acace7c
Author: Chacón <lechacon@users.noreply.github.com>
Date:   Fri, 10 Sep 2021 17:48:34 -0700

Show source identifier with `source list` (#1455)


Diffstat:
Msrc/AppInstallerCLICore/Resources.h | 1+
Msrc/AppInstallerCLICore/Workflows/SourceFlow.cpp | 1+
Msrc/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw | 4++++
Msrc/AppInstallerRepositoryCore/Rest/RestSourceFactory.cpp | 3+++
4 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/AppInstallerCLICore/Resources.h b/src/AppInstallerCLICore/Resources.h @@ -242,6 +242,7 @@ namespace AppInstaller::CLI::Resource WINGET_DEFINE_RESOURCE_STRINGID(SourceListCommandShortDescription); WINGET_DEFINE_RESOURCE_STRINGID(SourceListData); WINGET_DEFINE_RESOURCE_STRINGID(SourceListField); + WINGET_DEFINE_RESOURCE_STRINGID(SourceListIdentifier); WINGET_DEFINE_RESOURCE_STRINGID(SourceListName); WINGET_DEFINE_RESOURCE_STRINGID(SourceListNoneFound); WINGET_DEFINE_RESOURCE_STRINGID(SourceListNoSources); diff --git a/src/AppInstallerCLICore/Workflows/SourceFlow.cpp b/src/AppInstallerCLICore/Workflows/SourceFlow.cpp @@ -139,6 +139,7 @@ namespace AppInstaller::CLI::Workflow table.OutputLine({ Resource::Loader::Instance().ResolveString(Resource::String::SourceListType), source.Type }); table.OutputLine({ Resource::Loader::Instance().ResolveString(Resource::String::SourceListArg), source.Arg }); table.OutputLine({ Resource::Loader::Instance().ResolveString(Resource::String::SourceListData), source.Data }); + table.OutputLine({ Resource::Loader::Instance().ResolveString(Resource::String::SourceListIdentifier), source.Identifier }); if (source.LastUpdateTime == Utility::ConvertUnixEpochToSystemClock(0)) { diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw @@ -544,6 +544,10 @@ They can be configured through the settings file 'winget settings'.</value> <value>Name</value> <comment>The name of the source.</comment> </data> + <data name="SourceListIdentifier" xml:space="preserve"> + <value>Identifier</value> + <comment>The source's unique identifier.</comment> + </data> <data name="SourceListNoneFound" xml:space="preserve"> <value>Did not find a source named:</value> </data> diff --git a/src/AppInstallerRepositoryCore/Rest/RestSourceFactory.cpp b/src/AppInstallerRepositoryCore/Rest/RestSourceFactory.cpp @@ -39,6 +39,9 @@ namespace AppInstaller::Repository::Rest THROW_HR_IF(APPINSTALLER_CLI_ERROR_SOURCE_NOT_REMOTE, !Utility::IsUrlRemote(details.Arg)); THROW_HR_IF(APPINSTALLER_CLI_ERROR_SOURCE_NOT_SECURE, !Utility::IsUrlSecure(details.Arg)); + RestClient restClient = RestClient::Create(details.Arg, details.CustomHeader); + details.Identifier = restClient.GetSourceIdentifier(); + return true; }