modules and cmdlet wrappers

71 views
Skip to first unread message

dsteinmo

unread,
Nov 29, 2014, 3:01:11 PM11/29/14
to pash-p...@googlegroups.com
Hi,

I'm very interested in what you've done so far for this project. Are there plans for supporting cmdlet wrappers implemented in dll by implementing 'import-module' command and such? What is holding us back from such cmdlet support; are we waiting on a mono implementation of System.Management.Automation?

I wouldn't mind pitching in here or there where I can. Let me know if there's any low-hanging fruit I can dive into, or if there's something bigger I could help put a dent into.

Cheers,
dsteinmo.

Stefan Burnicki

unread,
Nov 30, 2014, 9:09:01 AM11/30/14
to pash-p...@googlegroups.com
Hi dsteinmo,

good news for you: It's already possible to write and use cmdlets for Pash. However, the current implementation to load cmdlets from a DLL is a little different to the PS behavior.
While PS can add installed cmdlets via 'Add-PSSnapin' or 'Import-Module', you can use this cmdlet in Pash to load local files, like 'Add-PSSnapin "/path/to/the.dll"'.
I'm also currently working on implementing the "real" module system of Powershell, including support for module manifests and script modules. But this can take some weeks.
So for now, you can use the Add-PSSnapin.

I even implemented cmdlets in two projects that are compatible with both Powershell and Pash:

While the source code is compatible with both Powershell and Pash, it's not yet completely binary compatible. It's still necessary to compile the cmdlets against Powershell to run them with Powershell. The other way round is already working: You can build the cmdlets against Pash OR Powershell to use them with Pash.

If you have any specific feature request you are missing for your work with Pash, just tell us. Maybe we can directly help you or at least tell you what concretely is missing or how the feature would be implemented. (We don't wait for mono to implement System.Management.Automation, as this is in fact mostly Powershell stuff that we implement on our own to run Pash).

Also don't hesitate to open issues for bugs you found or feature requests:

Regards,
Stefan

dsteinmo

unread,
Nov 30, 2014, 11:30:06 AM11/30/14
to pash-p...@googlegroups.com
Hi Stefan,

Thanks for your reply. The Snap-Ins functionality for loading cmdlets looks very cool based on the links you provided, and it will work fine until you've gotten a chance to add import-module, module manifests, etc.

I just made a blind/naive attempt to load my dll with Add-PSSnapin and got "The assembly contains either no or more than one PSSnapIn class!". Taking a look at your code for CmisCmdlets, it looks like I just need to add a class that extends PSSnapins and implements Description, Name and Vendor methods? Looks simple enough, and I will try this out when I get a moment.

I am still interested in getting involved with the project and I will take a look at your issues board to get a sense of how I might be able to help out.

Best of luck with the project,
Derek.

Stefan Burnicki

unread,
Dec 1, 2014, 2:19:37 PM12/1/14
to pash-p...@googlegroups.com
Hi Derek,

yes, you need simply include a class that derives from PSSnapin. I wanted to stick to the MS specification at that point. Once module support is finished, this class won't be necessary anymore to load a DLL as a module.

Help on the project is more than welcome. As it can be a little overwhelming at first, I started to write a little blog series about how the Pash project works. Unfortunately I have only written 2 parts of the series, yet, but maybe they will already help you:
http://blog.empalis-systems.com/understanding-pash-project/
http://blog.empalis-systems.com/pash-project-tests/

If you have *any* questions regarding the internals of Pash or the project itself, don't hesitate to ask.
Otherwise you can start with whatever you like. Maybe missing useful cmdlets, like 'Where-Object', can be a first start to get in touch with Pash without the need of understanding all internal stuff.

I don't know your experiences. If you are, by any chance, familiar with grammars/parsers, you can also dive into some issues we're currently having with the parser (like optional newlines).
That's a thing where currently none of us has an idea how to fix it, I'm afraid.

And if you just test things, find bugs, or review code, this is also fine :)

Regards,
Stefan
Reply all
Reply to author
Forward
0 new messages