-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix list/upgrade table for packages with multiple ARP entries. #2137
Changes from 5 commits
ca93379
07521bf
499c008
2959a36
589b6d8
51b20ec
8543c1d
7089b6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -710,6 +710,7 @@ namespace AppInstaller::CLI::Workflow | |||||
int unknownPackagesCount = 0; | ||||||
auto &source = context.Get<Execution::Data::Source>(); | ||||||
bool shouldShowSource = source.IsComposite() && source.GetAvailableSources().size() > 1; | ||||||
std::set<std::pair<Utility::LocIndString, Utility::LocIndString>> packageIdsPrinted; | ||||||
|
||||||
for (const auto& match : searchResult.Matches) | ||||||
{ | ||||||
|
@@ -730,27 +731,52 @@ namespace AppInstaller::CLI::Workflow | |||||
// The only time we don't want to output a line is when filtering and no update is available. | ||||||
if (updateAvailable || !m_onlyShowUpgrades) | ||||||
{ | ||||||
Utility::LocIndString availableVersion, sourceName; | ||||||
Utility::LocIndString availableVersion, sourceName, sourceIdentifier; | ||||||
Utility::LocIndString packageId = match.Package->GetProperty(PackageProperty::Id); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest that rather than storing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Getting value into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved in latest commit. Oops! |
||||||
|
||||||
if (latestVersion) | ||||||
{ | ||||||
// Always show the source for correlated packages | ||||||
sourceName = latestVersion->GetProperty(PackageVersionProperty::SourceName); | ||||||
sourceIdentifier = latestVersion->GetProperty(PackageVersionProperty::SourceIdentifier); | ||||||
|
||||||
if (updateAvailable) | ||||||
{ | ||||||
availableVersion = latestVersion->GetProperty(PackageVersionProperty::Version); | ||||||
availableUpgradesCount++; | ||||||
if (context.Args.Contains(Execution::Args::Type::ListAll) || !packageIdsPrinted.count({ packageId, sourceIdentifier })) | ||||||
{ | ||||||
// we should only add to the upgrade count if we actually showed the table entry. | ||||||
availableUpgradesCount++; | ||||||
} | ||||||
} | ||||||
|
||||||
// Always show the source for correlated packages | ||||||
sourceName = latestVersion->GetProperty(PackageVersionProperty::SourceName); | ||||||
} | ||||||
|
||||||
table.OutputLine({ | ||||||
match.Package->GetProperty(PackageProperty::Name), | ||||||
match.Package->GetProperty(PackageProperty::Id), | ||||||
installedVersion->GetProperty(PackageVersionProperty::Version), | ||||||
availableVersion, | ||||||
shouldShowSource ? sourceName : ""s | ||||||
}); | ||||||
if (context.Args.Contains(Execution::Args::Type::ListAll)) | ||||||
{ | ||||||
table.OutputLine({ | ||||||
installedVersion->GetProperty(PackageVersionProperty::Name), | ||||||
match.Package->GetProperty(PackageProperty::Id), | ||||||
installedVersion->GetProperty(PackageVersionProperty::Version), | ||||||
availableVersion, | ||||||
shouldShowSource ? sourceName : ""s | ||||||
}); | ||||||
} | ||||||
else | ||||||
{ | ||||||
// we need to only list once per package | ||||||
if (!packageIdsPrinted.count({ packageId, sourceIdentifier })) | ||||||
{ | ||||||
packageIdsPrinted.insert({ packageId, sourceIdentifier }); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Assuming that you also took my other suggestion above about keeping these as a |
||||||
table.OutputLine({ | ||||||
match.Package->GetProperty(PackageProperty::Name), | ||||||
match.Package->GetProperty(PackageProperty::Id), | ||||||
installedVersion->GetProperty(PackageVersionProperty::Version), | ||||||
availableVersion, | ||||||
shouldShowSource ? sourceName : ""s | ||||||
}); | ||||||
} | ||||||
} | ||||||
|
||||||
} | ||||||
} | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1308,4 +1308,7 @@ Please specify one of them using the `--source` option to proceed.</value> | |
<data name="NoPackageSelectionArgumentProvided" xml:space="preserve"> | ||
<value>No package selection argument was provided; see the help for details about finding a package.</value> | ||
</data> | ||
<data name="ListAllArgumentDescription" xml:space="preserve"> | ||
<value>List all software installed by a package</value> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: we try to make "package" the terminology for software across winget but I can see it's weird to say "all packages installed by a package" Maybe "List all package components installed by a package" or "List all sub-packages installed by a package" Open to any suggestions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @denelon, thoughts? I think "List all components installed by a package." makes the most sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I refer to these as "system artifacts" internally, but that probably isn't a great name for them publicly. I do like "components" or "items". |
||
</data> | ||
</root> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @Trenly that this could just use
Args::Type::All
(especially now that its not inForType
[which existed pre-localization, but now I don't think we should use]).Ultimately it's just another internal enum value, so it is more about how its makes us feel than anything else.