nightroman / Mdbc

MongoDB Cmdlets for PowerShell
Apache License 2.0
141 stars 16 forks source link

psm1 / Manifest please #80

Closed manuel-sperrle closed 1 year ago

manuel-sperrle commented 1 year ago

Hi nightroman,

could you please add a manifest / psm1 in order to have the module autoloading if needed?

Would be great.

Thx in advance Regards, Manu

nightroman commented 1 year ago

I do not understand this request on several levels :)

Can you please clarify all this and give more details. Versions, OS, etc.

manuel-sperrle commented 1 year ago

There is no FunctionsToExport etc. mentioned -> what i assume prevents autoload in the following configuration:

If you want to reproduce / to clarify - all versions are "latest" at the time of this post: Powershell docker container (mcr.microsoft.com/powershell) Mdbc Module is installed in AllUsers context using the Dockerfile (Install-Module Mdbc -Scope AllUsers) -> that config doesnt want to autoload the module - forced to explicitely either #require or to import the module


Just tested under Windows -> autoloading works - agreed


Me and some other guys discussed that topic earlier that day and maybe im not able to rephrase the issue properly in case you may want to join in: https://discord.gg/powershell

nightroman commented 1 year ago

I do not want to join discord. Try to rephrase this :) I know that it is "recommended" to list the provided commands in the manifest but I've never really seen / understood why. Are you asking to list the module commands in the manifest?

nightroman commented 1 year ago

NB Autoloading may not work right away. The initial explicit loading (or maybe even a few) is needed. Autoloading is some PS hidden not well documented magic.

manuel-sperrle commented 1 year ago

thx the reply again y basically just listing the "Exports": Commands/Cmdlets/Functions inside the psm1 should do - to my believes

there is also a little handy function to do this: https://learn.microsoft.com/de-de/powershell/module/microsoft.powershell.core/new-modulemanifest

nightroman commented 1 year ago

All right, I do not mind to list cmdlets in the manifest, say, "by the book". Fingers crossed, maybe this helps, cannot promise or expect anything though.

manuel-sperrle commented 1 year ago

thank you in advance allready - keeping all fingers crossed Thx a lot the invested work. (in general)

nightroman commented 1 year ago

v6.6.5 Please let me know if this helped (but I close anyway).

manuel-sperrle commented 1 year ago

y totally fine now :) - thanks a lot hint: you may want to remove the import-module in your example aswell - its not needed anymore

nightroman commented 1 year ago

I believe the explicit Import-Module is still needed for the very first use (like trying the example).

Thank you for reporting, I've learned something new and useful to know.

manuel-sperrle commented 1 year ago

Thank you for listening and instant fixing :)

Try out in a silent minute - the explicit Import should not be needed anymore