I've been writing a Cmdlet, and, to keep my interfaces clean, I've been manually exporting the functions I care about with Export-ModuleMember.
However, someone pointed out that I could also put my functions directly in the global: scope instead, without calling Export-ModuleMember.
Which one is preferable?
# Option A: Export-ModuleMember
function Do-Something {}
Export-ModuleMember -Function Do-Something
# Option B: global scope
function global:Do-AnotherThing {}
# Something else?
Thanks!
My hunch is that Export-ModuleMember is better since it lets the caller decide which scope the function ends up in (e.g. another cmdlet could import my cmdlet without exposing those exported functions globally), but I'm not sure.