-
Notifications
You must be signed in to change notification settings - Fork 929
(#1276) List command with last updated date #3775
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
base: develop
Are you sure you want to change the base?
(#1276) List command with last updated date #3775
Conversation
Add `--show-last-updated-date` option to the `list` command. When enabled, this displays the last date the package was installed or updated, alongside the usual metadata fields. Previously, users had no clear indication of when a local package was last changed. This new option provides better visibility and helps with package management, especially when filtering or sorting package lists by recency. Implementation details: - Introduced new switch `show-last-updated-date`. - Logs formatted date via `package.Published` (or fallback string if unavailable). - Integrated into existing `list` command output formatting. With this change, users can more easily audit their package states and track updates over time.
Add `--order-by-last-updated-date` option to the `list` command. When used, the command output is ordered by the date each package was last installed or updated. Previously, package listings were only ordered by name or version. This limited users who wanted to quickly identify the most recently changed packages. With this new option, users gain more control over list output and can better manage their environments based on package activity. Implementation details: - Introduced new switch `order-by-last-updated-date`. - Maps user input to `PackageOrder.LastPublished`. - Integrates naturally into existing sort logic of `list`.
Update `ChocolateyTabExpansion.ps1` to include the new `--show-last-updated-date` and `--order-by-last-updated-date` switches in the `list` command's tab completion options.
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.
Looks pretty solid, nice self-contained change, just a couple minor comments.
You will need to rebase this branch against develop
when you're done, just so the merge history is a bit tidier.
@@ -49,7 +49,7 @@ $commandOptions = @{ | |||
info = "--cert='' --certpassword='' --disable-repository-optimizations --include-configured-sources --local-only --password='' --prerelease --source='' --user='' --version=''" | |||
install = "--allow-downgrade --allow-empty-checksums --allow-empty-checksums-secure --apply-args-to-dependencies --apply-package-parameters-to-dependencies --cert='' --certpassword='' --disable-repository-optimizations --download-checksum='' --download-checksum-x64='' --download-checksum-type='' --download-checksum-type-x64='' --exit-when-reboot-detected --force-dependencies --forcex86 --ignore-checksum --ignore-dependencies --ignore-detected-reboot --ignore-package-exit-codes --include-configured-sources --install-arguments='' --not-silent --override-arguments --package-parameters='' --password='' --pin --prerelease --require-checksums --skip-hooks --skip-scripts --source='' --stop-on-first-failure --use-package-exit-codes --user='' --version=''" | |||
license = "" | |||
list = "--by-id-only --by-tag-only --detail --exact --id-only --id-starts-with --ignore-pinned --include-programs --page='' --page-size='' --prerelease --source='' --version=''" | |||
list = "--by-id-only --by-tag-only --detail --exact --id-only --id-starts-with --ignore-pinned --include-programs --page='' --page-size='' --prerelease --order-by-last-updated-date --show-last-updated-date --source='' --version=''" |
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 think most of our flags are given in alphabetical order in tab completion; could we put these in before --page
?
@@ -276,11 +276,12 @@ it is possible that incomplete package lists are returned from a command | |||
{ | |||
if (!(packageInfo != null && packageInfo.IsPinned && config.ListCommand.IgnorePinned)) | |||
{ | |||
this.Log().Info(logger, () => "{0}{1}".FormatWith(package.Identity.Id, config.ListCommand.IdOnly ? string.Empty : " {0}{1}{2}{3}".FormatWith( | |||
this.Log().Info(logger, () => "{0}{1}".FormatWith(package.Identity.Id, config.ListCommand.IdOnly ? string.Empty : " {0}{1}{2}{3} {4}".FormatWith( |
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.
Looking at how the other information is added here, it looks like the space before each arg is added below rather than here; I'm guessing that's probably due to not wanting to add trailing space and also to keep it simple to extend later on. For consistency's sake, can we do the same here? i.e., no space in this format string, but adding the space if the user is asking to show the last updated date -- similar to how the Approved / download cache information is done.
I think you can do that just by adding a space to the ToString() format string on line 284 and the "Last updated not available" string..
Description Of Changes
Motivation and Context
Testing
Operating Systems Testing
Change Types Made
Change Checklist
Related Issue
Partially fixes #1276