Skip to content

Commit 6a2762e

Browse files
authored
Details output option for list (#5939)
## Change The new experimental feature `listDetails` enables a new option for the `list` command, `--details`. When supplied, the output is no longer a table view of the results but is instead a series of `show` like outputs drawing data from the installed item. An example output for a single installed package is: ```PowerShell > wingetdev list Microsoft.VisualStudio.2022.Enterprise --details Visual Studio Enterprise 2022 [Microsoft.VisualStudio.2022.Enterprise] Version: 17.14.21 (November 2025) Publisher: Microsoft Corporation Local Identifier: ARP\Machine\X86\875fed29 Product Code: 875fed29 Installer Category: exe Installed Scope: Machine Installed Location: C:\Program Files\Microsoft Visual Studio\2022\Enterprise Available Upgrades: winget [17.14.23] ``` When there are multiple results, the identity line is prefixed with the standard `(N/M)` format string used in multi-package operations elsewhere. If sixels are enabled and supported by the terminal, an icon for the installed package will be shown. This currently models the mechanism used by winget-pkgs to extract the icons and by the `show` command to select the appropriate one to display. It is using the same code in the same manner and should be representative of what would be shown to the user if it were doing the full round trip through the repository/cache/`show` command.
1 parent 2a5a5e5 commit 6a2762e

File tree

25 files changed

+515
-166
lines changed

25 files changed

+515
-166
lines changed

doc/Settings.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,30 @@ This feature enables support for additional source command improvements via `win
403403
"sourceEdit": true
404404
},
405405
```
406+
407+
### listDetails
408+
409+
This feature enables support for displaying detailed output from the `list` command. Rather than a table view of the results, when the `--details` option is provided
410+
to the `list` command, it will output information similar to how `show` would. Most of the data presented is directly from the local installation.
411+
412+
Example output:
413+
```PowerShell
414+
> winget list Microsoft.VisualStudio.2022.Enterprise --details
415+
Visual Studio Enterprise 2022 [Microsoft.VisualStudio.2022.Enterprise]
416+
Version: 17.14.21 (November 2025)
417+
Publisher: Microsoft Corporation
418+
Local Identifier: ARP\Machine\X86\875fed29
419+
Product Code: 875fed29
420+
Installer Category: exe
421+
Installed Scope: Machine
422+
Installed Location: C:\Program Files\Microsoft Visual Studio\2022\Enterprise
423+
Available Upgrades:
424+
winget [17.14.23]
425+
```
426+
427+
To enable:
428+
```json
429+
"experimentalFeatures": {
430+
"listDetails": true
431+
},
432+
```

schemas/JSON/settings/settings.schema.0.2.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,16 @@
328328
"description": "Enable support for managing fonts",
329329
"type": "boolean",
330330
"default": false
331+
},
332+
"listDetails": {
333+
"description": "Enable detailed output option for list command",
334+
"type": "boolean",
335+
"default": false
336+
},
337+
"sourceEdit": {
338+
"description": "Enable source edit command",
339+
"type": "boolean",
340+
"default": false
331341
}
332342
}
333343
}

src/AppInstallerCLICore/Argument.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ namespace AppInstaller::CLI
108108
case Execution::Args::Type::TargetVersion:
109109
return { type, "version"_liv, 'v', ArgTypeCategory::SinglePackageQuery, ArgTypeExclusiveSet::AllAndTargetVersion };
110110

111-
//Source Command
111+
// Source Command
112112
case Execution::Args::Type::SourceName:
113113
return { type, "name"_liv, 'n' };
114114
case Execution::Args::Type::SourceType:
@@ -124,13 +124,13 @@ namespace AppInstaller::CLI
124124
case Execution::Args::Type::SourceEditExplicit:
125125
return { type, "explicit"_liv, 'e' };
126126

127-
//Hash Command
127+
// Hash Command
128128
case Execution::Args::Type::HashFile:
129129
return { type, "file"_liv, 'f' };
130130
case Execution::Args::Type::Msix:
131131
return { type, "msix"_liv, 'm' };
132132

133-
//Validate Command
133+
// Validate Command
134134
case Execution::Args::Type::ValidateManifest:
135135
return { type, "manifest"_liv };
136136
case Execution::Args::Type::IgnoreWarnings:
@@ -183,6 +183,8 @@ namespace AppInstaller::CLI
183183
// List command
184184
case Execution::Args::Type::Upgrade:
185185
return { type, "upgrade-available"_liv};
186+
case Execution::Args::Type::ListDetails:
187+
return { type, "details"_liv };
186188

187189
// Pin command
188190
case Execution::Args::Type::GatedVersion:
@@ -482,6 +484,8 @@ namespace AppInstaller::CLI
482484
return Argument{ type, Resource::String::FontDetailsArgumentDescription, ArgumentType::Flag, false };
483485
case Args::Type::Correlation:
484486
return Argument{ type, Resource::String::CorrelationArgumentDescription, ArgumentType::Standard, Argument::Visibility::Hidden };
487+
case Args::Type::ListDetails:
488+
return Argument{ type, Resource::String::ListDetailsArgumentDescription, ArgumentType::Flag, Argument::Visibility::Help, ExperimentalFeature::Feature::ListDetails };
485489
default:
486490
THROW_HR(E_UNEXPECTED);
487491
}

src/AppInstallerCLICore/Commands/ListCommand.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace AppInstaller::CLI
3131
Argument{ Execution::Args::Type::Upgrade, Resource::String::UpgradeArgumentDescription, ArgumentType::Flag, Argument::Visibility::Help },
3232
Argument{ Execution::Args::Type::IncludeUnknown, Resource::String::IncludeUnknownInListArgumentDescription, ArgumentType::Flag },
3333
Argument{ Execution::Args::Type::IncludePinned, Resource::String::IncludePinnedInListArgumentDescription, ArgumentType::Flag},
34+
Argument::ForType(Execution::Args::Type::ListDetails),
3435
};
3536
}
3637

src/AppInstallerCLICore/ExecutionArgs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ namespace AppInstaller::CLI::Execution
111111

112112
// List Command
113113
Upgrade, // Used in List command to only show versions with upgrades
114+
ListDetails,
114115

115116
// Pin command
116117
GatedVersion, // Differs from Version in that this supports wildcards

src/AppInstallerCLICore/Resources.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ namespace AppInstaller::CLI::Resource
432432
WINGET_DEFINE_RESOURCE_STRINGID(Links);
433433
WINGET_DEFINE_RESOURCE_STRINGID(ListCommandLongDescription);
434434
WINGET_DEFINE_RESOURCE_STRINGID(ListCommandShortDescription);
435+
WINGET_DEFINE_RESOURCE_STRINGID(ListDetailsArgumentDescription);
435436
WINGET_DEFINE_RESOURCE_STRINGID(LocaleArgumentDescription);
436437
WINGET_DEFINE_RESOURCE_STRINGID(LocationArgumentDescription);
437438
WINGET_DEFINE_RESOURCE_STRINGID(LogArgumentDescription);
@@ -635,6 +636,7 @@ namespace AppInstaller::CLI::Resource
635636
WINGET_DEFINE_RESOURCE_STRINGID(ShowCommandShortDescription);
636637
WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelAgreements);
637638
WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelAuthor);
639+
WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelChannel);
638640
WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelCopyright);
639641
WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelCopyrightUrl);
640642
WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelDependencies);
@@ -666,6 +668,17 @@ namespace AppInstaller::CLI::Resource
666668
WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelVersion);
667669
WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelWindowsFeaturesDependencies);
668670
WINGET_DEFINE_RESOURCE_STRINGID(ShowLabelWindowsLibrariesDependencies);
671+
WINGET_DEFINE_RESOURCE_STRINGID(ShowListAvailableUpgrades);
672+
WINGET_DEFINE_RESOURCE_STRINGID(ShowListInstalledArchitecture);
673+
WINGET_DEFINE_RESOURCE_STRINGID(ShowListInstalledLocale);
674+
WINGET_DEFINE_RESOURCE_STRINGID(ShowListInstalledLocation);
675+
WINGET_DEFINE_RESOURCE_STRINGID(ShowListInstalledScope);
676+
WINGET_DEFINE_RESOURCE_STRINGID(ShowListInstalledSource);
677+
WINGET_DEFINE_RESOURCE_STRINGID(ShowListInstallerCategory);
678+
WINGET_DEFINE_RESOURCE_STRINGID(ShowListLocalIdentifier);
679+
WINGET_DEFINE_RESOURCE_STRINGID(ShowListPackageFamilyName);
680+
WINGET_DEFINE_RESOURCE_STRINGID(ShowListProductCode);
681+
WINGET_DEFINE_RESOURCE_STRINGID(ShowListUpgradeCode);
669682
WINGET_DEFINE_RESOURCE_STRINGID(ShowVersion);
670683
WINGET_DEFINE_RESOURCE_STRINGID(SilentArgumentDescription);
671684
WINGET_DEFINE_RESOURCE_STRINGID(SingleCharAfterDashError);

src/AppInstallerCLICore/Sixel.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,15 +432,18 @@ namespace AppInstaller::CLI::VirtualTerminal::Sixel
432432
m_sourceImage = anon::CacheToBitmap(m_factory.get(), decodedFrame.get());
433433
}
434434

435-
ImageSource::ImageSource(std::istream& imageStream, Manifest::IconFileTypeEnum imageEncoding)
435+
ImageSource::ImageSource(std::istream& imageStream, Manifest::IconFileTypeEnum imageEncoding) :
436+
ImageSource(Utility::ReadEntireStreamAsByteArray(imageStream), imageEncoding)
437+
{
438+
}
439+
440+
ImageSource::ImageSource(const std::vector<uint8_t>& imageBytes, Manifest::IconFileTypeEnum imageEncoding)
436441
{
437442
m_factory = anon::CreateFactory();
438443

439444
wil::com_ptr<IStream> stream;
440445
THROW_IF_FAILED(CreateStreamOnHGlobal(nullptr, TRUE, &stream));
441446

442-
auto imageBytes = Utility::ReadEntireStreamAsByteArray(imageStream);
443-
444447
ULONG written = 0;
445448
THROW_IF_FAILED(stream->Write(imageBytes.data(), static_cast<ULONG>(imageBytes.size()), &written));
446449
THROW_IF_FAILED(stream->Seek({}, STREAM_SEEK_SET, nullptr));
@@ -637,6 +640,10 @@ namespace AppInstaller::CLI::VirtualTerminal::Sixel
637640
m_imageSource(imageStream, imageEncoding)
638641
{}
639642

643+
Image::Image(const std::vector<uint8_t>& imageBytes, Manifest::IconFileTypeEnum imageEncoding) :
644+
m_imageSource(imageBytes, imageEncoding)
645+
{}
646+
640647
Image& Image::AspectRatio(Sixel::AspectRatio aspectRatio)
641648
{
642649
m_renderControls.AspectRatio = aspectRatio;

src/AppInstallerCLICore/Sixel.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ namespace AppInstaller::CLI::VirtualTerminal::Sixel
145145
// Create an image source from a stream.
146146
ImageSource(std::istream& imageStream, Manifest::IconFileTypeEnum imageEncoding);
147147

148+
// Create an image source from bytes.
149+
ImageSource(const std::vector<uint8_t>& imageBytes, Manifest::IconFileTypeEnum imageEncoding);
150+
148151
// Resize the image to the given width and height, factoring in the target aspect ratio for rendering.
149152
// If stretchToFill is true, the resulting image will be both the given width and height.
150153
// If false, the resulting image will be at most the given width or height while preserving the aspect ratio.
@@ -221,6 +224,9 @@ namespace AppInstaller::CLI::VirtualTerminal::Sixel
221224
// Create an image from a stream.
222225
Image(std::istream& imageStream, Manifest::IconFileTypeEnum imageEncoding);
223226

227+
// Create an image from bytes.
228+
Image(const std::vector<uint8_t>& imageBytes, Manifest::IconFileTypeEnum imageEncoding);
229+
224230
// Set the aspect ratio of the result.
225231
Image& AspectRatio(AspectRatio aspectRatio);
226232

src/AppInstallerCLICore/Workflows/ConfigurationFlow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@ namespace AppInstaller::CLI::Workflow
14171417
unit.Identifier(sourceNameWide + L'_' + packageIdWide);
14181418
unit.Intent(ConfigurationUnitIntent::Apply);
14191419

1420-
auto description = Resource::String::ConfigureExportUnitInstallDescription(Utility::LocIndView{ package.Id });
1420+
auto description = Resource::String::ConfigureExportUnitInstallDescription(package.Id);
14211421

14221422
ValueSet directives;
14231423
directives.Insert(s_Directive_Description, PropertyValue::CreateString(winrt::to_hstring(description.get())));

src/AppInstallerCLICore/Workflows/ImportExportFlow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ namespace AppInstaller::CLI::Workflow
108108
auto channel = installedPackageVersion->GetProperty(PackageVersionProperty::Channel);
109109

110110
// Find an available version of this package to determine its source.
111-
auto availablePackageVersion = GetAvailableVersionForInstalledPackage(context, packageMatch.Package, Utility::LocIndView{ version }, Utility::LocIndView{ channel }, includeVersions);
111+
auto availablePackageVersion = GetAvailableVersionForInstalledPackage(context, packageMatch.Package, version, channel, includeVersions);
112112
if (!availablePackageVersion)
113113
{
114114
// Report package not found and move to next package.

0 commit comments

Comments
 (0)