Skip to content

Commit

Permalink
add zpm version and current refistry
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaylenko_sv committed Jul 20, 2023
1 parent e548249 commit d6ee931
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions src/%ZPM/PackageManager.cls
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,30 @@ ClassMethod TerminalPrompt() As %String
Quit prompt
}

/// @API.Method
/// Get Version modules and current registry
/// example do ##class(%ZPM.PackageManager).GetVersion("zpm,zpm-registry",.out,.list)
ClassMethod GetVersion(ModuleName, ByRef out, list)
{
Do ..GetListModules("*", ModuleName, .list)
for i=1:1 { quit:'$d(list(i),ns)
set ns=$lg(ns,1)
for ii=1:1 { quit:'$d(list(i,"modules",ii),module)
set out($lg(module,1))=$lb(ns,$lg(module,2))
}
}
set sc=$$$OK
set sql="select URL from %ZPM_PackageManager_Client.RemoteServerDefinition where Enabled = 1"
,rs=##class(%ResultSet).%New()
,sc=rs.Prepare(sql)
Set:sc sc=rs.Execute("")
If sc {
Quit:'rs.%Next()
set out=rs.Get("URL")
}
Quit sc
}

/// For use in unit tests that need to test if a command threw any exceptions.
ClassMethod ShellInternal(pCommand As %String, Output pException As %Exception.AbstractException) [ Internal ]
{
Expand All @@ -477,9 +501,11 @@ ClassMethod ShellInternal(pCommand As %String, Output pException As %Exception.A
If (tCommand '= "") {
Set tOneCommand = 1
}
do ##class(%ZPM.PackageManager).GetVersion("zpm",.out)
Set introMessageList = $ListBuild(
"Welcome to the Package Manager Shell (ZPM).",
"Enter q/quit to exit the shell. Enter ?/help to view available commands"
"Welcome to the Package Manager Shell (ZPM). version "_$$$FormattedLine($$$Cyan,$lg($g(out("zpm")),2)),
"Enter q/quit to exit the shell. Enter ?/help to view available commands",
"Current registry "_$$$FormattedLine($$$Cyan,$g(out))
)
Set tInShell = 0
For {
Expand Down Expand Up @@ -2508,3 +2534,4 @@ ClassMethod DisplayModules(ByRef pList, pNumbered As %Boolean = 0, pWithNamespac
}

}

0 comments on commit d6ee931

Please sign in to comment.