{"id":18048115,"url":"https://github.com/startautomating/splatter","last_synced_at":"2025-04-10T09:49:19.407Z","repository":{"id":36894090,"uuid":"195514988","full_name":"StartAutomating/Splatter","owner":"StartAutomating","description":"Simple Scripts to Supercharge Splatting","archived":false,"fork":false,"pushed_at":"2023-05-16T03:05:08.000Z","size":226,"stargazers_count":62,"open_issues_count":4,"forks_count":0,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-05-02T02:59:01.459Z","etag":null,"topics":["powershell","splatting"],"latest_commit_sha":null,"homepage":null,"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},"funding":{"github":["StartAutomating"]}},"created_at":"2019-07-06T08:11:46.000Z","updated_at":"2023-12-29T05:45:06.000Z","dependencies_parsed_at":"2024-01-14T04:45:05.332Z","dependency_job_id":"b49e0dae-c7d1-4583-a7c4-cdff413f59dd","html_url":"https://github.com/StartAutomating/Splatter","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FSplatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FSplatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FSplatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FSplatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StartAutomating","download_url":"https://codeload.github.com/StartAutomating/Splatter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248197461,"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":["powershell","splatting"],"created_at":"2024-10-30T20:11:40.736Z","updated_at":"2025-04-10T09:49:19.386Z","avatar_url":"https://github.com/StartAutomating.png","language":"PowerShell","readme":"﻿\u003cdiv align='center'\u003e\n\u003cimg src='Assets/Splatter.png' style='align:center' /\u003e\n\u003ch1\u003eSimple Scripts to Supercharge Splatting\u003c/h1\u003e\n\u003c/div\u003e\n\n[![Test Build And Publish](https://github.com/StartAutomating/Splatter/actions/workflows/TestBuildAndPublish.yml/badge.svg)](https://github.com/StartAutomating/Splatter/actions/workflows/TestBuildAndPublish.yml)\n\n## Splatter is a simple Splatting toolkit\n\nSplatting is a technique of passing parameters in PowerShell.\n\nSplatter makes splatting more powerful, flexible, and easy to use.\n\nWith Splatter you can:\n* Splat any object to any command\n* Pipe splats to commands\n* Validate splats \n* Find commands for a splat\n\nSplatter is tiny, and can be easily embedded into any module, or used to generate splatting code.\n\n### Using Splatter\n\nSplatter has four core commands:\n* Get-Splat (?@)\n* Find-Splat (??@)\n* Merge-Splat (*@)\n* Use-Splat (.@)\n\n#### Get-Splat\n\n|   Alias   |       Variables            |\n|-----------|----------------------------|\n| ?@,gSplat | ${?@}, $gSplat, $GetSplat  |\n\n\nGet-Splat returns a Dictionary of parameters, given a command or ScriptBlock.  \nThis only contains parameters for the command, and converts the parameters into the desired types.\nGet-Splat can take any object or Dictionary as input.\n\n    @{Id=$pid;Junk='Data'} | Get-Splat Get-Process    \n    # -or \n    @{Id=$pid;Junk='Data'} | ?@ gps\n    # -or\n    @{Id=$pid;Junk='Data'} | \u0026 ${?@} gps\n\n\nGet-Splat can take more than one command as input.\nIf it does, it will return the matching inputs for each command.        \n    \n    @{FilePath = 'pwsh';ArgumentList = '-noprofile';PassThru=$true} | \n        Use-Splat Start-Process |\n        Add-Member NoteProperty TimeOut 15 -PassThru | \n        Get-Splat Wait-Process, Stop-Process\n\nGet-Splat will also attach a properties to the Dictionary.  \n\nThese property won't be used when calling the splat, but can be peeked at:\n\n|   Property    |   Description                                 |\n|---------------|-----------------------------------------------|\n|  Command      |           The Command                         |\n|  CouldRun     |  If the command could run, given the splat    | \n|  Invalid      |  Parameters that are invalid                  |\n|  Missing      |  Mandatory parameters that are missing        |\n|  PercentFit   |  % of properties that map to parameters       |\n|  Unmapped     |  Properties that don't map to parameters      |\n\n\n    $splat = @{id=$pid;foo='bar'} | ?@ gps\n    $splat.Command, $splat.PercentFit, $splat.Unmapped\n\n\n#### Find-Splat\n|   Alias    |       Variables            |\n|------------|----------------------------|\n| ??@,fSplat | ${??@}, $fSplat, $FindSplat|\n\n\n\nFind-Splat will find commands that match a given splat, and return information about a match.\n\n    @{id=$pid} | Find-Splat *-Process\n\nFind-Splat may also be scoped to a given module\n\n    @{splat=@{}} | Find-Splat -Module Splatter\n\n#### Merge-Splat\n|   Alias    |       Variables            |\n|------------|----------------------------|\n| *@,mSplat  | ${*@}, $mSplat, $MergeSplat|\n\n\nMerge splat will merge multiple splats together.\n\n    @{a='b'}, @{c='d'} | Merge-Splat\n\n\n#### Use-Splat\n\n|   Alias      |       Variables                  |\n|--------------|----------------------------------|\n| .@,uSplat    | ${.@},  $uSplat, $UseSplat       |\n\n\nUse-Splat will run a splat against one or more commands.\n    @{id=$pid} | Use-Splat Get-Process # Gets the current process\n\n    # Gets the process, and then doesn't stop the process because Stop-Process is passed WhatIf\n    @{id=$pid;WhatIf=$true} | .@ Get-Process,Stop-Process \n\n\n### Using Splatter with ScriptBlocks\n\n\nIn PowerShell, you can treat any ScriptBlock as a command.  Splatter makes this simpler.\n\nTake this example, which takes a little bit of input data and uses it in a few different scripts.\n\n    @{\n        Name='James'\n        Birthday = '12/17/1981'\n        City = 'Seattle'\n        State = 'Washington'\n    } | .@ {\n        param($Name)\n        \"$name\"\n    }, {\n        param([DateTime]$Birthday)\n        $ageTimespan = [DateTime]::Now - $birthday\n        \"Age:\" + [Math]::Floor($ageTimespan.TotalDays / 365)\n        \n    }, {\n        param($city, $state)\n        \"$city, $state\"\n    }\n\nSince Splatter will also convert objects to hashtables, you could also write something like:\n\n    Import-Csv .\\People.csv | .@ \n        {\n            param($Name)\n            \"$name\"\n        }, {\n            param([DateTime]$Birthday)\n            $ageTimespan = [DateTime]::Now - $birthday\n            \"Age:\" + [Math]::Floor($ageTimespan.TotalDays / 365)\n        \n        }\n\n\n### Embedding Splatter\n\nInitialize-Splat will output a script containing the core commands for Splatter.\nUsing this output, you can directly embed Splatter into any script or module.\n\n    Initialize-Splatter\n\nTo install this into a module:\n\n    Get-Module TheNameOfYourModule | Split-Path | Push-Location    \n    Initialize-Splatter \u003e '@.ps1'\n    Pop-Location\n\nThen add the following line to your module:\n\n    . $psScriptRoot\\@.ps1\n\nBy default, when Splatter is embedded, it will not export functions or aliases, and you will need to use the variable syntax:\n\n    \u0026 ${?@}  # Get-Splat\n    \u0026 ${??@} # Find-Splat\n    \u0026 ${*@}  # Merge-Splat\n    \u0026 ${.@}  # Use-Splat     \n\nYou can override this by using -AsFunction\n\n    Initialize-Splatter -AsFunction\n\nIf you don't need all of the commands, you can use -Verb\n\n    Initialize-Splatter -Verb Get, Use\n\n\n\n### Generating Splatting Code\n\nYou can use Out-Splat to generate code that splats.\n\n    Out-Splat -CommandName Get-Command -DefaultParameter @{Module='Splatter';CommandType='Alias'} | Invoke-Expression\n\nYou can use also use Out-Splatter to generate whole functions, including help.\n\n    $scriptBlock = \n        Out-Splat -FunctionName Get-SplatterAlias -CommandName Get-Command -DefaultParameter @{\n            Module='Splatter';CommandType='Alias'\n        } -ExcludeParameter * -Synopsis 'Gets Splatter Aliases' -Description 'Gets aliases from the module Splatter'\n    . ([ScriptBlock]::Create($scriptBlock))\n\n    Get-SplatterAlias | Out-String\n    Get-Help Get-SplatterAlias | Out-String","funding_links":["https://github.com/sponsors/StartAutomating"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartautomating%2Fsplatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstartautomating%2Fsplatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartautomating%2Fsplatter/lists"}