A powershell module used to create powershell providers using a simple DSL
C# PowerShell
Latest commit 1006c55 Jan 31, 2016 Jim Christopher initial attempt at adding -add and -remove scriptblocks to Script nod…
…es; fixed recursive provider proxy issue for Simplex items

README.md

Build status

Module ZipDownload Module Zip

Simplex

A powershell module used to create powershell providers using a simple DSL.

Example Usage

This example assumes the following Simplex script file is available at c:\share\mydrive.ps1:

Simplex Script

root {
   folder MyFolder {
       script MyEnvironment -id key {
           dir env:
       }
       script MyModules -id guid {
            get-module
       }
   }
}

PowerShell Session

import-module simplex
new-psdrive s -psprovider simplex -root "c:\share\mydrive.ps1"
cd s:\myfolder\mymodules
dir

Simplex DSL

The provider DSL consists of three elements:

  • root - used to define the root of the drive tree; the root may contain any number of folder and/or script elements
  • folder - used to define simple named containers on the drive; the folder may contain any number of folder and/or script elements
  • script - used to define a named collection of items; the script element uses a PowerShell script to return the items it contains; you can specify a property name use as the child name of the item

Example: Canonical Drive

root {
   folder MyFolder {
       script MyEnvironment -id key {
           dir env:
       }
       script MyModules -id guid {
            get-module
       }
   }
}

Example: Generated Drive Content

root {
   folder System {
       script Processes -id id {
           get-process
       }

       script Errors -id index {
           get-eventlog -log application -eventtype error -newest 50
       }
   }

   folder Generated {
       0..9 | foreach-object {
           $content = $_;
           script "Generated$_" {
               $content
           }.GetNewClosure();
       }
    }
}