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

For templating#3553. Make search results downloads column optional #33024

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

levimatheri
Copy link
Contributor

@levimatheri levimatheri commented Jun 4, 2023

For dotnet/templating issue 3553. Make search results downloads column optional. FYI @vlada-shubina

fixes dotnet/templating#3553

@levimatheri levimatheri requested a review from a team as a code owner June 4, 2023 19:08
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Request triage from a team member label Jun 4, 2023
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@YuliiaKovalova
Copy link
Member

@levimatheri , please fix the tests

Copy link
Member

@vlada-shubina vlada-shubina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @YuliiaKovalova, please fix the tests before we can merge.

@@ -153,7 +153,7 @@ private static string EvaluatePackageToShow(IReadOnlyList<SearchResult> searchRe
.DefineColumn(r => r.TemplateGroupInfo.Classifications, LocalizableStrings.ColumnNameTags, TabularOutputSettings.ColumnNames.Tags, defaultColumn: false, shrinkIfNeeded: true, minWidth: 10)
.DefineColumn(r => GetPackageInfo(r.PackageName, r.PackageOwners), out object? packageColumn, LocalizableStrings.ColumnNamePackageNameAndOwners, showAlways: true)
.DefineColumn(r => GetReservedMark(r.Reserved), LocalizableStrings.ColumnNameTrusted, showAlways: true, textAlign: TextAlign.Center)
.DefineColumn(r => r.PrintableTotalDownloads, out object? downloadsColumn, LocalizableStrings.ColumnNameTotalDownloads, showAlways: true, textAlign: TextAlign.Center);
.DefineColumn(r => r.PrintableTotalDownloads, LocalizableStrings.ColumnNameTotalDownloads, TabularOutputSettings.ColumnNames.Downloads, defaultColumn: false, textAlign: TextAlign.Center);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.DefineColumn(r => r.PrintableTotalDownloads, LocalizableStrings.ColumnNameTotalDownloads, TabularOutputSettings.ColumnNames.Downloads, defaultColumn: false, textAlign: TextAlign.Center);
.DefineColumn(r => r.PrintableTotalDownloads, LocalizableStrings.ColumnNameTotalDownloads, TabularOutputSettings.ColumnNames.Downloads, textAlign: TextAlign.Center);

please keep this column available by default

@@ -137,7 +137,8 @@ internal static Option<string[]> CreateColumnsOption()
TabularOutputSettings.ColumnNames.Author,
TabularOutputSettings.ColumnNames.Language,
TabularOutputSettings.ColumnNames.Type,
TabularOutputSettings.ColumnNames.Tags);
TabularOutputSettings.ColumnNames.Tags,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this option is now reused for dotnet new list and dotnet new search. Downloads are only applicable for dotnet new search, therefore please create two separate options now.

Copy link
Contributor Author

@levimatheri levimatheri Jun 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want these two separate options created in this same SharedOptionsFactory? Wasn't sure if having them both here defeats the purpose of a 'shared' class(?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo, they can now live in respective command implementations

Copy link
Contributor Author

@levimatheri levimatheri Jun 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vlada-shubina It's getting a bit hairy with the NewCommand.Legacy which calls into SharedOptionsFactory for it's ColumnOptions, and the legacy list and search referencing the same ParentCommand. I tried to use AcceptOnlyFromAmong, but that seems to clear the allowed options, such that when I try dotnet new console --columns downloads --search, I get Argument 'downloads' not regonized. Must be one of: 'author' 'language' 'type' 'tags', because the LegacyList options overwrites the LegacySearch options since they are both using the same reference of Options from ParentCommand. Any suggestions on how to go about this?

@vlada-shubina
Copy link
Member

@joeloff @MiYanni please review too if you have time. It may be useful for learning purposes

@levimatheri levimatheri force-pushed the templating-issue-3553/make-downloads-optional branch from c97c8c5 to d014fcd Compare June 18, 2023 00:40
@levimatheri
Copy link
Contributor Author

working on fixing the tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider making dowloads optional
3 participants