Skip to content

feat: add semantic sorting and shortcuts to list-installed#1079

Open
AshokThangavel wants to merge 6 commits into
intersystems:mainfrom
AshokThangavel:feat/list-installed-sorting
Open

feat: add semantic sorting and shortcuts to list-installed#1079
AshokThangavel wants to merge 6 commits into
intersystems:mainfrom
AshokThangavel:feat/list-installed-sorting

Conversation

@AshokThangavel
Copy link
Copy Markdown
Contributor

Enhanced Sorting for list-installed

Overview

This PR introduces a new -sort (shortcut -s) modifier to the list-installed command. It allows users to organize their installed modules by Name, Installation Date, or Semantic Version, significantly improving manageability for environments with many packages

fixes: #1071

Features Added

  • Three New Sort Modes:

  • name: Alphabetical sorting (case-insensitive).

  • date: Chronological sorting based on when the module was installed.

  • version: Semantic version sorting (handling Major.Minor.Patch logic).

  • Descending Order Support: Added a -desc (or -d) suffix to all sort modes to reverse the output.

  • Power-User Shortcuts: Implemented shorthand notation for faster CLI usage:

  • n, n-d (Name)

  • d, d-d (Date)

  • v, v-d (Version)

Testing Performed

Verified all combinations of sort keys and directions via the ZPM shell:

  • Confirmed list -s v-d correctly places version 4.1.2 above 1.0.1.
  • Confirmed list -s d-d places the most recently installed module at the top.
  • Validated that shortforms (e.g., list -s n-d) resolve correctly to their full counterparts.
zpm:USER>list 
IPM (zpm)         0.10.6-SNAPSHOT
irisJWT (irisjwt) 1.0.1
objectscript-math 0.0.5
testify           1.0.2
zpm:USER>list -s name-desc
testify           1.0.2
objectscript-math 0.0.5
irisJWT (irisjwt) 1.0.1
IPM (zpm)         0.10.6-SNAPSHOT
zpm:USER>list -s d-d
testify           1.0.2
irisJWT (irisjwt) 1.0.1
objectscript-math 0.0.5
IPM (zpm)         0.10.6-SNAPSHOT
zpm:USER>list -s v-d 
testify           1.0.2
irisJWT (irisjwt) 1.0.1
IPM (zpm)         0.10.6-SNAPSHOT
objectscript-math 0.0.5

Copy link
Copy Markdown
Collaborator

@isc-dchui isc-dchui left a comment

Choose a reason for hiding this comment

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

Just a few minor things. Thanks for tackling this and all the other issues! I promise to actually get your changes merged once we've sorted out all this IPM regression instability. (We're almost there...)

Comment thread src/cls/IPM/Main.cls Outdated
Comment thread src/cls/IPM/Main.cls Outdated
Comment thread CHANGELOG.md Outdated
@isc-dchui
Copy link
Copy Markdown
Collaborator

@AshokThangavel I think you also need to pull from main here to resolve merge conflicts

@AshokThangavel
Copy link
Copy Markdown
Contributor Author

I’ve pulled the latest changes from main and resolved the conflicts in CHANGELOG.md. The new entry has been updated to 0.10.7. Thank you!

isc-dchui
isc-dchui previously approved these changes Mar 11, 2026
Copy link
Copy Markdown
Collaborator

@isc-kiyer isc-kiyer left a comment

Choose a reason for hiding this comment

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

@AshokThangavel few small notes

Comment thread src/cls/IPM/Main.cls Outdated
<modifier name="showupstream" aliases="su" description="If specified, show the latest version for each module in configured repos if it's different than the local version." />
<modifier name="repository" aliases="repo" value="true" description="If specified, only show modules installed that belong to the provided repository." />
<modifier name="python" aliases="py" description="If specified, lists installed Embedded Python libraries instead of IPM modules." />
<modifier name="sort" aliases="s" value="true" description="Sort the list. Options: name, name-desc, date, date-desc, version, version-desc" />
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Default sort (if flag not provided) should be ascending by name. Should indicate that here.

set ..Version = pResolvedReference.Version
set ..Deployed = pResolvedReference.Deployed
set ..PlatformVersions = pResolvedReference.PlatformVersions
set ..VersionString = pResolvedReference.VersionString
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems like a mistake in merging from main. These should not be removed.

Comment thread tests/unit_tests/Test/PM/Unit/CLI.cls Outdated
{
do $$$LogMessage("Testing list-installed sorting flags")
set status = ..RunCommand("list")
set status = ..RunCommand("list -s n")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tests should read output and confirm its sorted in the correct order. Should also test ascending and descending for each sort modifier

@isc-dchui isc-dchui added this to the v0.10.7 milestone Apr 22, 2026
AshokThangavel and others added 5 commits May 15, 2026 13:36
- Implement -sort (-s) for name, date, and version.
- Fix version collation using numeric $List segments (e.g., 0.10 > 0.2).
- Add descending order support via -desc suffix (e.g., v-d, d-d).
- Support power-user shortforms (n, d, v) for all sort modes.
- Update help documentation with usage examples.
…or with identical versions were overwriting each other by introducing a new subscript to differentiate them
@isc-dchui isc-dchui force-pushed the feat/list-installed-sorting branch from 1d41039 to caf6e60 Compare May 15, 2026 19:02
@isc-dchui
Copy link
Copy Markdown
Collaborator

Addressed @isc-kiyer's comments and made the sort by name ascending the default even without the -sort flag. IPM itself will always appear on the top of the list.

@isc-dchui isc-dchui requested a review from isc-kiyer May 15, 2026 19:04
isc-tleavitt
isc-tleavitt previously approved these changes May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sort -list command output

4 participants