{"id":18048089,"url":"https://github.com/startautomating/piecemeal","last_synced_at":"2025-07-05T23:36:22.224Z","repository":{"id":36981794,"uuid":"439972592","full_name":"StartAutomating/Piecemeal","owner":"StartAutomating","description":"Easy Extensible Plugins for PowerShell","archived":false,"fork":false,"pushed_at":"2024-07-01T17:55:01.000Z","size":296,"stargazers_count":13,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T08:46:04.002Z","etag":null,"topics":["extension","plugin","powershell","powershell-module"],"latest_commit_sha":null,"homepage":"https://piecemeal.start-automating.com","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StartAutomating.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["StartAutomating"]}},"created_at":"2021-12-19T21:33:55.000Z","updated_at":"2024-09-13T11:17:56.000Z","dependencies_parsed_at":"2024-10-30T20:21:42.628Z","dependency_job_id":null,"html_url":"https://github.com/StartAutomating/Piecemeal","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPiecemeal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPiecemeal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPiecemeal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPiecemeal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StartAutomating","download_url":"https://codeload.github.com/StartAutomating/Piecemeal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248197459,"owners_count":21063619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["extension","plugin","powershell","powershell-module"],"created_at":"2024-10-30T20:11:33.693Z","updated_at":"2025-04-10T09:49:12.568Z","avatar_url":"https://github.com/StartAutomating.png","language":"PowerShell","funding_links":["https://github.com/sponsors/StartAutomating"],"categories":[],"sub_categories":[],"readme":"﻿Piecemeal enables Easy Extensible Plugins for PowerShell.\n\n## What is Piecemeal?\n\nPiecemeal is a little PowerShell module that helps solve a big problem: PowerShell extensibility.\n\nPiecemeal allows function and scripts to have extended capabilities and act as extensions for any command.\n\nPiecemeal standardizes these capabilities and provides a simple function you can embed into any module to power an engine of extensibility.\n\n#### Installing Piecemeal\n\nYou can embed Piecemeal by using Install-Piecemeal:\n\n```PowerShell\nInstall-Piecemeal -ExtensionModuleName MyModule -Verb Get -OutputPath .\\Get-MyModuleExtension.ps1\n```\n\nThis will create the source for the command Get-MyModuleExtension.\nGet-MyModuleExtension is a modified copy of Get-Extension that returns only extensions related to MyModule.\n\n**NOTE: Your Module does not have to Require or Nest Piecemeal**\n\n#### Extending a Function\n\nOnce Piecemeal has been installed into a module, you can allow any command to be extended with two easy optional steps:\n\n1. Add dynamic parameters from extensions\n\n```PowerShell\n    # Add this block to any function to make the function extensible (change the name of the extension command as needed)\n    dynamicParam {        \n        Get-MyModuleExtension -CommandName $MyInvocation.MyCommand -DynamicParameter\n    }\n```\n\n2. Run the extension\n\n\nBy default, running your extension command will produce an object containing:\n* CommandName (the name of the command)\n* ExtensionCommand (the extension command)\n* ExtensionOutput (the output from the extension)\n* Done (indicates if you should stop processing additional extensions)\n\n```PowerShell\n    # Add this wherever you would like within the function you're extending.  \n    # This will return an object with the output of each extension\n    Get-MyModuleExtension -Run -CommandName $MyInvocation.Mycommand \n```\n\nYou can also run the extension and -Stream the results\n```PowerShell\n    # Add this wherever you would like within the function you're extending.  \n    # This will return an object with the output of each extension\n    Get-MyModuleExtension -Run -Stream -CommandName $MyInvocation.Mycommand -Parameter (@{} + $psBoundParameters)\n```\n\nAlternatively, you can determine what -CouldRun:\n```PowerShell\n    # Add this wherever you would like within the function you're extending.  \n    # This will return an object with the output of each extension\n    Get-MyModuleExtension -CouldRun -CommandName $MyInvocation.Mycommand -Parameter (@{} + $psBoundParameters)\n```\n\nOnce you have completed these steps, your command can be extended.  \nExtensions can exist within your module or any module that adds your module to it's tags.\n\n### Extension Scripts Structure\n\nExtensions are simple scripts files named with the regular expression ```\\.(extension|ext|ex|x)\\.ps1$```.\n\nThe often include the name of the module that contains the commands that are being extended, for example ```AudioGain.RoughDraft.Extension.ps1```.\n\nThey can be automatically discovered in any module that adds the tag \"Piecemeal\", or can be discovered beneath an extension path.\n\nExtensions should include the following attributes above their parameter block:\n\n~~~PowerShell\n# It's an extension (this is optional, unless you use -RequireExtensionAttribute)\n[Runtime.CompilerServices.Extension()]\n# Next one or more Cmdlet attribute define the command that is being extended.\n# (this is also optional, unless you use -RequireCmdletAttribute )\n[Management.Automation.Cmdlet(\"Set\",\"Something\")]\n# Finally, an extension can indicate how it should be Inherited with the ComponentModel.Inheritance attribute.\n# An extension that is 'Inherited' should return control to the main function when it is done.  This is the default\n# An extension that is 'NotInherited' should run and return directly.\n# An extension that is 'InheritedReadOnly' should only declare parameters\n[ComponentModel.Inheritance(\"Inherited\")]\nparam(\n# It's good practice to make at least one parameter of the extension should be mandatory.\n[Parameter(Mandatory)]\n[switch]\n$MyEditExtension\n)\n~~~","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartautomating%2Fpiecemeal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstartautomating%2Fpiecemeal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartautomating%2Fpiecemeal/lists"}