Pash-Project / Pash

An Open Source reimplementation of Windows PowerShell, for Mono.
https://groups.google.com/group/pash-project
BSD 3-Clause "New" or "Revised" License
514 stars 54 forks source link

How to create module for pash? #386

Open ArsenShnurkov opened 9 years ago

ArsenShnurkov commented 9 years ago

http://www.darkoperator.com/blog/2013/2/19/powershell-basics-extending-the-shell-with-modules-and-snapi.html

is it possible at all? ( yes, probably, since 2015-01-06 - https://github.com/Pash-Project/Pash/pull/331 , https://github.com/Pash-Project/Pash/issues/332 )

PASH /> get-module all
PASH />  

works, but doesn't show anything...

This tutorial doesn't work: https://www.simple-talk.com/sysadmin/powershell/an-introduction-to-powershell-modules/

PASH /> New-ModuleManifest
Command 'New-ModuleManifest' not found.
  +CategoryInfo: ObjectNotFound, Reason: ParentContainsErrorRecordException
  +FullyQualifiedErrorId: CommandNotFoundException
PASH />  

PASH /> Get-Module -ListAvailable
No parameter was found that matches the name or alias 'ListAvailable'.
  +CategoryInfo: InvalidArgument, Reason: ParameterBindingException
  +FullyQualifiedErrorId: ParameterNotFound
PASH /> 
sburnicki commented 9 years ago

Here is a blog entry about what works, and doesn't work yet with our module system: http://blog.empalis-systems.com/module-support-pash/

We don't have a (graphical) interface to create manifest, yet (as New-ModuleManifest). But you can just write some in an editor, as in this example. Note that a manifest is optional for simple script & binary modules.

Get-Module -ListAvailable doesn't work yet, as the results of the discussion of #332 haven't been integrated yet, so Pash doesn't know where to look for modules. But this is on my TODO list ;) For now, you can import modules by using the absolute or relative path to the module location.