Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- #961: Adding creation of a lock file for a module by using the `-create-lockfile` flag on install.
- #959: In ORAS repos, external name can now be used interchangeably with (default) name for `install` and `update`, i.e. a module published with its (default) name can be installed using its external name.
- #951: The `unpublish` command will skip user confirmation prompt if the `-force` flag is provided.
- #1018: Require module name for uninstall when not using the -all flag

### Changed
- #316: All parameters, except developer mode, included with a `load`, `install` or `update` command will be propagated to dependencies
Expand Down
5 changes: 4 additions & 1 deletion src/cls/IPM/Main.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,10 @@ ClassMethod Uninstall(ByRef pCommandInfo) [ Internal ]
$$$ThrowOnError(##class(%IPM.Utils.Module).UninstallAll(tForce,.tParams))
return
} else {
set tModuleName = pCommandInfo("parameters","module")
set tModuleName = $get(pCommandInfo("parameters","module"))
if (tModuleName = "") {
$$$ThrowOnError($$$ERROR($$$GeneralError, "A module name must be specified for uninstall unless the -all flag is used."))
}
if (tModuleName = $$$IPMModuleName) {
$$$ThrowOnError(..CheckModuleNamespace())
}
Expand Down
20 changes: 18 additions & 2 deletions tests/unit_tests/Test/PM/Unit/CLI.cls
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,12 @@ Method CompareModifiers(
}
}

Method RunCommand(pCommand As %String)
/// This method returns the %Status for checking the success or failure of executed commands.
Method RunCommand(pCommand As %String) As %Status
{
do ##class(%IPM.Main).Shell(pCommand)
set status = ##class(%IPM.Main).Shell(pCommand)
do $$$LogMessage("Run command: "_pCommand)
return status
}

Method AssertNoException(pCommand As %String)
Expand Down Expand Up @@ -313,4 +315,18 @@ Method TestListPython() As %Status
quit sc
}

Method TestUninstallWithoutModuleName()
{
do $$$LogMessage("Run Uninstall command without module name")
set status = ..RunCommand("uninstall")
do $$$AssertStatusNotOK(status, $system.Status.GetErrorText(status))
set status = ..RunCommand("install objectscript-math")
do $$$AssertStatusOK(status, "objectscript-math module installed successfully.")
set exists = ##class(%IPM.Storage.Module).NameExists("objectscript-math")
do $$$AssertTrue(exists, "objectscript-math Module exists in storage after installation.")
do ..RunCommand("uninstall objectscript-math")
set exists = ##class(%IPM.Storage.Module).NameExists("objectscript-math")
do $$$AssertNotTrue(exists, "Module removed successfully.")
}

}