PowerShell Core on Linux.
# this works
Remove-Module psreadline
# this fails
Import-Module psreadline
# you need to run
Import-Module PSReadLine
Consistent behavior for both cmdlets.
# this works
Remove-Module psreadline
# this fails
Import-Module psreadline
PS /home/aleksandar> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-alpha
PSEdition Core
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.18
CLRVersion
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
@alexandair Thanks for your report!
I believe if on Unix we allow import different modules modulename and Modulename we should be case-sensitive in Remove-Module and Get-Module too?
Is it a good idea to allow case-sensitive module names considering that Windows will not support such module names as its file system is case-insensitive? Seems like PowerShell should treat modules as case-insensitive. I don't see any value in allowing posh-git, Posh-Git and Posh-GIT to be different modules. I think that would just lead to confusion. IMO all of the module-related commands should be case-insensitive. And if on Linux someone has both mymodule and MyModule dirs. and is trying to import Mymodule, PowerShell should warn the user about the conflict.
If we consider the module names as case-insensitive, then should we do the same in relation to the names of scripts and other PowerShell files?
I don't think so. Script filename casing should following the OS's casing rules. That said, the PowerShell Gallery should consider warning (or rejecting) when publishing scripts that would stomp a different script with the same name on a case-insensitive file system. Either that or use some other means of disambiguation (author name, pub-date, version, etc).
I expect that this will amaze users that .psm1 is case-insensitive and .ps1 case-sensitive.
Loading a module by path doesn't have to follow the same rules as loading a module by name. Considering module "names" are backed by file system names, I'll admit this gets messy. But given that command names in PowerShell are case-insensitive, it seems like the right way to go.
I believe this is an application of the question raised in #706. Ideally, we should address this all up.
Most helpful comment
Is it a good idea to allow case-sensitive module names considering that Windows will not support such module names as its file system is case-insensitive? Seems like PowerShell should treat modules as case-insensitive. I don't see any value in allowing posh-git, Posh-Git and Posh-GIT to be different modules. I think that would just lead to confusion. IMO all of the module-related commands should be case-insensitive. And if on Linux someone has both mymodule and MyModule dirs. and is trying to import Mymodule, PowerShell should warn the user about the conflict.