diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6f72ed274..1d61600e0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,11 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
## [0.10.7] - Unreleased
### Added
- #992: Implement automatic history purge logic
- #973: Enables CORS and JWT configuration for WebApplications in module.xml
+- #1079: add semantic sorting and shortcuts to list-installed
### Fixed
- #1001: The `unmap` and `enable` commands will now only activate CPF merge once after all namespaces have been configured instead after every namespace
diff --git a/src/cls/IPM/Main.cls b/src/cls/IPM/Main.cls
index 64f7e2819..8eeb23aeb 100644
--- a/src/cls/IPM/Main.cls
+++ b/src/cls/IPM/Main.cls
@@ -527,6 +527,17 @@ reinstall -env /path/to/env1.json;/path/to/env2.json example-package
list -python
+
+ list -s [name|date|version]
+
+
+
+ list -s name-desc
+
+
+ list -s d-d
+
+
@@ -538,6 +549,7 @@ reinstall -env /path/to/env1.json;/path/to/env2.json example-package
+
@@ -2809,6 +2821,44 @@ ClassMethod ListInstalled(ByRef pCommandInfo) [ Private ]
}
}
merge tModifiers = pCommandInfo("modifiers")
+ set sortMode = $$$lcase($get(pCommandInfo("modifiers", "sort")))
+
+ if sortMode'="" {
+ set newlist =""
+ set type = $extract(sortMode, 1) // "d", "n", or "v"
+ set isDesc = (sortMode [ "-d")
+ set sortMode = $case(type, "n":"name", "d":"date", "v":"version", :"name")
+ if isDesc {
+ set sortMode = sortMode_"-desc"
+ }
+ for i=1:1:list {
+ set entry = list(i)
+ set name = $listget(entry,1)
+ set entry = entry_$listbuild(i)
+ if sortMode["name"{
+ set newlist($$$lcase(name),i)=entry
+ } elseif sortMode["date" {
+ set date = $listget(entry,6)
+ set newlist(date,name) = entry
+ } elseif sortMode["version" {
+ set newlist($listfromstring($listget(entry,2),"."),name) = entry
+ }
+ kill list(i)
+ }
+ set direction = $select(sortMode [ "desc": -1, 1: 1)
+ set sub = ""
+ if $data(newlist)>1 {
+ // create new list based on the sorting
+ for {
+ set sub = $order(newlist(sub),direction) quit:sub=""
+ set mod=""
+ for {
+ set mod = $order(newlist(sub,mod),direction,data) quit:mod=""
+ set list($increment(mlist))=data
+ }
+ }
+ }
+ }
do ..DisplayModules(.list,,,, .tModifiers)
}
}
diff --git a/src/cls/IPM/Storage/QualifiedModuleInfo.cls b/src/cls/IPM/Storage/QualifiedModuleInfo.cls
index 71ad0fa9b..3d77a8964 100644
--- a/src/cls/IPM/Storage/QualifiedModuleInfo.cls
+++ b/src/cls/IPM/Storage/QualifiedModuleInfo.cls
@@ -20,8 +20,6 @@ Method %OnNew(
set ..Version = pResolvedReference.Version
set ..Deployed = pResolvedReference.Deployed
set ..PlatformVersions = pResolvedReference.PlatformVersions
- set ..VersionString = pResolvedReference.VersionString
- set ..AllVersions = pResolvedReference.AllVersions
}
quit $$$OK
}
diff --git a/tests/unit_tests/Test/PM/Unit/CLI.cls b/tests/unit_tests/Test/PM/Unit/CLI.cls
index 8e9f2329a..49084315a 100644
--- a/tests/unit_tests/Test/PM/Unit/CLI.cls
+++ b/tests/unit_tests/Test/PM/Unit/CLI.cls
@@ -352,4 +352,16 @@ Method TestUninstallWithoutModuleName()
do $$$AssertNotTrue(exists, "Module removed successfully.")
}
+Method TestListSortingFlags()
+{
+ do $$$LogMessage("Testing list-installed sorting flags")
+ set status = ..RunCommand("list")
+ set status = ..RunCommand("list -s n")
+ do $$$AssertStatusOK(status, "Sort by name command executed successfully")
+ set status = ..RunCommand("list -s v-d")
+ do $$$AssertStatusOK(status, "Sort by version descending executed successfully")
+ set status = ..RunCommand("list -s d-d")
+ do $$$AssertStatusOK(status, "Sort by date descending executed successfully")
+}
+
}