en-US/CompleterActions-help.xml
|
<?xml version="1.0" encoding="utf-8"?> <helpItems xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" schema="maml" xmlns="http://msh"> <command:command> <command:details> <command:name>Get-CompleterRegistration</command:name> <maml:description> <maml:para>Gets completer registrations known to the module or discovered at runtime.</maml:para> </maml:description> <command:verb>Get</command:verb> <command:noun>CompleterRegistration</command:noun> </command:details> <maml:description> <maml:para>Returns completer registration records for all registrations, specific registration keys, native command completers, or command parameter completers. By default the command merges module-managed registrations with runtime-discovered registrations and prefers the managed record when both refer to the same target and the managed record still matches the live runtime value. When the runtime registration was replaced outside this module, the live discovered value is returned with State 'Conflicted' instead; -ManagedOnly returns the managed record with State 'Stale'. When the runtime registration was removed outside this module, the managed record is returned with State 'Stale' and IsRuntimeRegistered false. The command accepts arrays for key, command, and parameter lookup scenarios and supports property-name pipeline binding for key-based and target-based lookups.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-CompleterRegistration</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>ManagedOnly</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>DiscoveredOnly</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>IncludeTotalCount</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Skip</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">ulong</command:parameterValue> <dev:type> <maml:name>System.UInt64</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>First</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">ulong</command:parameterValue> <dev:type> <maml:name>System.UInt64</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="RegistrationKey"> <maml:name>Key</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>ManagedOnly</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>DiscoveredOnly</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>IncludeTotalCount</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Skip</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">ulong</command:parameterValue> <dev:type> <maml:name>System.UInt64</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>First</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">ulong</command:parameterValue> <dev:type> <maml:name>System.UInt64</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>ParameterName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>ManagedOnly</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>DiscoveredOnly</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>IncludeTotalCount</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Skip</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">ulong</command:parameterValue> <dev:type> <maml:name>System.UInt64</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>First</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">ulong</command:parameterValue> <dev:type> <maml:name>System.UInt64</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Native</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>ManagedOnly</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>DiscoveredOnly</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>IncludeTotalCount</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Skip</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">ulong</command:parameterValue> <dev:type> <maml:name>System.UInt64</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>First</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">ulong</command:parameterValue> <dev:type> <maml:name>System.UInt64</maml:name> </dev:type> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description> <maml:para>Limits results to one or more command names for native or command-parameter completers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>DiscoveredOnly</maml:name> <maml:description> <maml:para>Returns only registrations discovered from the current PowerShell runtime.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>First</maml:name> <maml:description> <maml:para /> </maml:description> <command:parameterValue required="true" variableLength="true">System.UInt64</command:parameterValue> <dev:type> <maml:name>System.UInt64</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>IncludeTotalCount</maml:name> <maml:description> <maml:para /> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="RegistrationKey"> <maml:name>Key</maml:name> <maml:description> <maml:para>Gets the registrations that match one or more registration keys.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>ManagedOnly</maml:name> <maml:description> <maml:para>Returns only registrations tracked by this module.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="IsNative"> <maml:name>Native</maml:name> <maml:description> <maml:para>Indicates that the lookup target is a native command completer instead of a command parameter completer.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="none"> <maml:name>ParameterName</maml:name> <maml:description> <maml:para>Limits results to one or more parameter completer targets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>Skip</maml:name> <maml:description> <maml:para /> </maml:description> <command:parameterValue required="true" variableLength="true">System.UInt64</command:parameterValue> <dev:type> <maml:name>System.UInt64</maml:name> </dev:type> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSCustomObject</maml:name> </dev:type> <maml:description> <maml:para>Returns CompleterActions.CompleterRegistration records.</maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSObject</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para /> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--------- EXAMPLE 1 ---------</maml:title> <maml:introduction> <maml:para>Get-CompleterRegistration -CommandName 'git' -Native</maml:para> <maml:para>€</maml:para> <maml:para>Gets the registration record for the native completer currently associated with git.</maml:para> </maml:introduction> <dev:code /> <dev:remarks /> </command:example> <command:example> <maml:title>--------- EXAMPLE 2 ---------</maml:title> <maml:introduction> <maml:para>Get-CompleterRegistration -Key 'git:checkout', 'git:branch'</maml:para> <maml:para>€</maml:para> <maml:para>Gets multiple completer registrations by key in a single call.</maml:para> </maml:introduction> <dev:code /> <dev:remarks /> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>text</maml:linkText> <maml:uri>https://github.com/tstager/CompleterActions/blob/deae4ca162751c60861237e1d2825f9b0f1fd0ff/src/docs/CompleterActions/Get-CompleterRegistration.md</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command> <command:details> <command:name>Import-CompleterScript</command:name> <maml:description> <maml:para>Imports self-contained completer scripts into registration input objects.</maml:para> </maml:description> <command:verb>Import</command:verb> <command:noun>CompleterScript</command:noun> </command:details> <maml:description> <maml:para>Parses and validates one or more completer scripts, executes them inside a temporary module that shadows `Register-ArgumentCompleter`, and emits objects that can be piped directly to `Register-CompleterRegistration -InputObject`. The command has two tiers. The strict tier is the default: it validates the script against a closed grammar before executing it, rejects every unsupported construct with the same findings `Test-CompleterScript` reports, and avoids mutating the live runtime completer tables during import. The trusted tier, selected with `-Trusted`, skips the grammar and dot-sources the script as-is inside the same capture module, so use it only for scripts you wrote or reviewed. Imported script blocks preserve the temporary module context that contains any helper functions and script-scope state defined by the source script under either tier. ## COMPATIBLE COMPLETER SCRIPT SPECIFICATION Write standalone completer scripts to this specification if you want them to remain importable through the strict tier without redesign. Run `Test-CompleterScript` to check a script against it: - Keep the script self-contained. Do not dot-source other scripts, and do not use `#requires -Modules`, `#requires -Assembly`, `using module`, or `using assembly`; they load code when the script is dot-sourced. - Keep script scope limited to: - `Set-StrictMode` - function definitions - importer-safe `if` statements - script-scope `Register-ArgumentCompleter` calls - Do not use top-level assignments, loops, `try`/`catch`, alias bootstrap, cache initialization, generated completion loading, or external command execution. - Register completers directly with the built-in `Register-ArgumentCompleter`; do not wrap registration in custom helper functions. - Use only these `Register-ArgumentCompleter` parameters: - `-CommandName` - `-ParameterName` - bare `-Native` - `-ScriptBlock` - Use explicit parameter names only. Positional registration arguments and argument splatting are not supported. - Keep target metadata literal: - `-CommandName` and `-ParameterName` may be a single literal string - a literal string array - or a literal `@('name', 'name.exe')` array expression - Keep `-ScriptBlock` literal. - Keep `Register-ArgumentCompleter` calls at script scope, not inside nested functions or nested script blocks. - Move alias bootstrap, cache initialization, generated completion loading, and other setup into lazy, idempotent helper paths reached from the registered completion script block.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Import-CompleterScript</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="0" aliases="none"> <maml:name>Path</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Trusted</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Import-CompleterScript</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="PSPath"> <maml:name>LiteralPath</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Trusted</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="PSPath"> <maml:name>LiteralPath</maml:name> <maml:description> <maml:para>One or more literal paths to completer script files. Wildcards are not expanded.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="0" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>One or more paths to completer script files. Wildcards are supported.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>Trusted</maml:name> <maml:description> <maml:para>Skips the strict grammar validation and dot-sources the script as-is inside the capture module. Everything at script scope runs at import time, exactly as it would when the script is dot-sourced from a profile. The emitted records carry `Trusted` set to `$true`.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSCustomObject</maml:name> </dev:type> <maml:description> <maml:para>Returns `CompleterActions.ImportedCompleterRegistration` records compatible with `Register-CompleterRegistration -InputObject`. The `Trusted` property records which tier produced the record.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para>Importer compatibility and runtime correctness are both required for future standalone completer scripts. Check the script with `Test-CompleterScript`, then verify the real completion behavior with `Test-CompleterRegistration` in a `pwsh -NoProfile` session before treating a completer as complete.</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--------- EXAMPLE 1 ---------</maml:title> <maml:introduction> <maml:para>```PowerShell Import-CompleterScript -Path .\7z_completer.ps1 | Register-CompleterRegistration -PassThru ```</maml:para> <maml:para>€</maml:para> <maml:para>Imports a supported completer script and registers the imported definitions through the module's managed registration API.</maml:para> </maml:introduction> <dev:code /> <dev:remarks /> </command:example> <command:example> <maml:title>--------- EXAMPLE 2 ---------</maml:title> <maml:introduction> <maml:para>```PowerShell Register-ArgumentCompleter -Native -CommandName @('tool', 'tool.exe') -ScriptBlock { param($wordToComplete, $commandAst, $cursorPosition) Complete-Tool -WordToComplete $wordToComplete -CommandAst $commandAst -CursorPosition $cursorPosition } ```</maml:para> <maml:para>€</maml:para> <maml:para>This is the preferred registration shape for an import-compatible native completer. Keep setup logic in helper functions that run from `Complete-Tool` rather than at script scope.</maml:para> </maml:introduction> <dev:code /> <dev:remarks /> </command:example> <command:example> <maml:title>--------- EXAMPLE 3 ---------</maml:title> <maml:introduction> <maml:para>```PowerShell Import-CompleterScript -Path .\git_completer.ps1 -Trusted | Register-CompleterRegistration ```</maml:para> <maml:para>€</maml:para> <maml:para>Imports a completer script you own without validating it against the strict grammar, then registers it. The imported records carry `Trusted` set to `$true`.</maml:para> </maml:introduction> <dev:code /> <dev:remarks /> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>text</maml:linkText> <maml:uri>https://github.com/tstager/CompleterActions/blob/deae4ca162751c60861237e1d2825f9b0f1fd0ff/src/docs/CompleterActions/Import-CompleterScript.md</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command> <command:details> <command:name>Register-CompleterRegistration</command:name> <maml:description> <maml:para>Registers a managed PowerShell argument completer.</maml:para> </maml:description> <command:verb>Register</command:verb> <command:noun>CompleterRegistration</command:noun> </command:details> <maml:description> <maml:para>Registers native or command-parameter argument completers with Register-ArgumentCompleter and records the registrations in the module's managed state. Existing managed or runtime registrations are preserved unless you use -Force to replace them. Registering the same script for a target that is already managed is idempotent only while the managed record still matches the live runtime value; when the runtime registration was replaced or removed outside this module, the managed record is stale and the command fails until you reconcile it with -Force. Each target is updated transactionally: if the runtime or managed write fails, the previous runtime and managed state are restored and any rollback failure is reported alongside the original error. The command supports array inputs for command and parameter targets, and it can also accept pipeline InputObject values that describe the target and expose a ScriptBlock property.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Register-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>ParameterName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>ScriptBlock</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.ScriptBlock</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>WhatIf</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Confirm</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Register-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">psobject[]</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.PSObject[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>WhatIf</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Confirm</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Register-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Native</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>ScriptBlock</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.ScriptBlock</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>WhatIf</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Confirm</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description> <maml:para>Specifies one or more command names whose completers should be registered.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Removes an existing managed or runtime registration for the same target before registering the new completer.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="Named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Supplies one or more objects that describe completer targets. Input objects must expose target metadata through Key, RegistrationKey, RuntimeKey, or CommandName/ParameterName plus IsNative/Native, and must expose a ScriptBlock property whose value is a script block.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.Management.Automation.PSObject[]</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.PSObject[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="IsNative"> <maml:name>Native</maml:name> <maml:description> <maml:para>Registers native completers for the commands instead of parameter completers.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="none"> <maml:name>ParameterName</maml:name> <maml:description> <maml:para>Specifies one or more parameter names for command-parameter completer registrations.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns the managed registration records that were created or reused.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>ScriptBlock</maml:name> <maml:description> <maml:para>Provides the completer script block to register. When multiple targets are supplied through arrays, the same script block is reused for each target.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.Management.Automation.ScriptBlock</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.ScriptBlock</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Runs the command in a mode that only reports what would happen without performing the actions.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.PSObject[]</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSCustomObject</maml:name> </dev:type> <maml:description> <maml:para>When -PassThru is used</maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSObject</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para /> </maml:alert> </maml:alertSet> <command:examples /> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>text</maml:linkText> <maml:uri>https://github.com/tstager/CompleterActions/blob/deae4ca162751c60861237e1d2825f9b0f1fd0ff/src/docs/CompleterActions/Register-CompleterRegistration.md</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command> <command:details> <command:name>Test-CompleterRegistration</command:name> <maml:description> <maml:para>Runs tab completion for an input against a registered completer target.</maml:para> </maml:description> <command:verb>Test</command:verb> <command:noun>CompleterRegistration</command:noun> </command:details> <maml:description> <maml:para>Resolves a completer target, confirms that it has a live runtime registration, and runs `TabExpansion2` for the supplied input text. The completion matches are returned as `CompleterActions.CompletionMatch` records that carry the target key alongside `CompletionText`, `ListItemText`, `ResultType`, and `ToolTip`, so the same check that used to be done by hand after every registration can be scripted and asserted on. One input text invokes one completer, so each call tests exactly one target. The target parameters accept the same shapes as `Get-CompleterRegistration` so registration records and property-bound values pipe in, but the command throws when more than one target resolves in a single call. The command only reads the completion engine. It does not change any registration, and it never touches PSReadLine.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Test-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>ParameterName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>InputText</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CursorPosition</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>System.Int32</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Test-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">psobject[]</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.PSObject[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>InputText</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CursorPosition</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>System.Int32</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Test-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="RegistrationKey"> <maml:name>Key</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>InputText</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CursorPosition</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>System.Int32</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Test-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Native</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>InputText</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CursorPosition</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>System.Int32</maml:name> </dev:type> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description> <maml:para>Specifies the command name of the native or command-parameter completer target.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>CursorPosition</maml:name> <maml:description> <maml:para>The zero-based cursor position within `InputText` at which completion runs. The default is the end of the input.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.Int32</command:parameterValue> <dev:type> <maml:name>System.Int32</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="Named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Supplies an object that describes the completer target, such as a record returned by `Get-CompleterRegistration` or `Import-CompleterScript`. The object must expose target metadata through `Key`, `RegistrationKey`, `RuntimeKey`, or `CommandName`/`ParameterName` plus `IsNative`/`Native`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.Management.Automation.PSObject[]</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.PSObject[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>InputText</maml:name> <maml:description> <maml:para>The command line to complete, exactly as it would be typed at the prompt. It must invoke the target's command, because the matches come from whatever command the text names.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="RegistrationKey"> <maml:name>Key</maml:name> <maml:description> <maml:para>Identifies the target by registration key. A key without a colon is treated as a native command. A key with a colon is treated as a `Command:Parameter` target unless the text after its last colon contains a path separator, in which case it is treated as a native command path such as `C:\tools\example.exe`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="IsNative"> <maml:name>Native</maml:name> <maml:description> <maml:para>Indicates that the target is a native command completer instead of a command parameter completer.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="none"> <maml:name>ParameterName</maml:name> <maml:description> <maml:para>Specifies the parameter name of the command-parameter completer target.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.PSObject[]</maml:name> </dev:type> <maml:description> <maml:para>A registration record, or any object that describes a completer target.</maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para>A registration key or command and parameter names bound by property name.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSCustomObject</maml:name> </dev:type> <maml:description> <maml:para>Returns `CompleterActions.CompletionMatch` records, one per completion match, with `Key`, `RuntimeKey`, `CommandName`, `ParameterName`, `CompleterType`, `InputText`, `CursorPosition`, `CompletionText`, `ListItemText`, `ResultType`, and `ToolTip` properties. Nothing is returned when the completer yields no matches.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para>Completion runs from the module's scope, so the commands named in `InputText` must be resolvable from the global scope, as they are in an interactive session. Functions defined in a script's local scope are not visible to the completion engine when it is invoked from this command.</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--------- EXAMPLE 1 ---------</maml:title> <maml:introduction> <maml:para>```PowerShell Test-CompleterRegistration -CommandName git -Native -InputText 'git che' ```</maml:para> <maml:para>€</maml:para> <maml:para>Returns the completion matches the registered git completer produces for `git che`, such as `checkout`, `cherry`, and `cherry-pick`.</maml:para> </maml:introduction> <dev:code /> <dev:remarks /> </command:example> <command:example> <maml:title>--------- EXAMPLE 2 ---------</maml:title> <maml:introduction> <maml:para>```PowerShell Get-CompleterRegistration -CommandName Invoke-DemoTool -ParameterName Name | Test-CompleterRegistration -InputText 'Invoke-DemoTool -Name a' ```</maml:para> <maml:para>€</maml:para> <maml:para>Verifies a registration record returned by `Get-CompleterRegistration` by completing an argument for its parameter.</maml:para> </maml:introduction> <dev:code /> <dev:remarks /> </command:example> <command:example> <maml:title>--------- EXAMPLE 3 ---------</maml:title> <maml:introduction> <maml:para>```PowerShell $matches = Test-CompleterRegistration -CommandName git -Native -InputText 'git che' $matches.CompletionText | Should -Contain 'checkout' ```</maml:para> <maml:para>€</maml:para> <maml:para>Asserts on the matches inside a Pester test.</maml:para> </maml:introduction> <dev:code /> <dev:remarks /> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-CompleterRegistration</maml:linkText> <maml:uri>Get-CompleterRegistration.md</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-CompleterScript</maml:linkText> <maml:uri>Test-CompleterScript.md</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command> <command:details> <command:name>Test-CompleterScript</command:name> <maml:description> <maml:para>Checks completer scripts against the strict import grammar and reports findings.</maml:para> </maml:description> <command:verb>Test</command:verb> <command:noun>CompleterScript</command:noun> </command:details> <maml:description> <maml:para>Parses one or more completer scripts and runs the same validation that `Import-CompleterScript` applies before it executes a script. Instead of stopping at the first problem, the command returns one `CompleterActions.CompleterScriptFinding` record per unsupported construct with the line and column, the construct type, a message, and a hint that describes how to change the script so it imports under the strict tier. A conforming script produces no output, so a conformance test can assert that the command returns nothing, or filter on `Severity` the way the strict importer does. A script that cannot be parsed yields one finding per parse error and is not checked further. `Test-CompleterScript` never executes the script.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Test-CompleterScript</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="0" aliases="FullName"> <maml:name>Path</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Test-CompleterScript</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="PSPath"> <maml:name>LiteralPath</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="PSPath"> <maml:name>LiteralPath</maml:name> <maml:description> <maml:para>One or more literal paths to completer script files. Wildcards are not expanded.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="0" aliases="FullName"> <maml:name>Path</maml:name> <maml:description> <maml:para>One or more paths to completer script files. Wildcards are supported.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSCustomObject</maml:name> </dev:type> <maml:description> <maml:para>Returns `CompleterActions.CompleterScriptFinding` records with `Path`, `Line`, `Column`, `Severity`, `Construct`, `Message`, and `Hint` properties. Every finding the strict grammar produces has `Severity` `Error`.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para>`Import-CompleterScript` builds its strict-tier error text from the same findings, so the two commands cannot disagree about what the grammar accepts. Scripts that must stay outside the grammar can be imported with `Import-CompleterScript -Trusted` instead of being rewritten.</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--------- EXAMPLE 1 ---------</maml:title> <maml:introduction> <maml:para>```PowerShell Test-CompleterScript -Path .\tool_completer.ps1 ```</maml:para> <maml:para>€</maml:para> <maml:para>Reports each construct that keeps the script from importing under the strict tier, or nothing when the script conforms.</maml:para> </maml:introduction> <dev:code /> <dev:remarks /> </command:example> <command:example> <maml:title>--------- EXAMPLE 2 ---------</maml:title> <maml:introduction> <maml:para>```PowerShell Get-ChildItem -Path ~\Completers -Recurse -Filter *.ps1 | Test-CompleterScript | Where-Object Severity -eq Error ```</maml:para> <maml:para>€</maml:para> <maml:para>Runs the conformance check over a completer repository. The pipeline is empty when every script conforms.</maml:para> </maml:introduction> <dev:code /> <dev:remarks /> </command:example> <command:example> <maml:title>--------- EXAMPLE 3 ---------</maml:title> <maml:introduction> <maml:para>```PowerShell Describe 'completer conformance' { It 'imports under the strict tier: <Name>' -TestCases ( Get-ChildItem -Path $PSScriptRoot -Filter *_completer.ps1 -File | ForEach-Object { @{ Name = $_.Name; Path = $_.FullName } } ) { param($Path)</maml:para> <maml:para>€</maml:para> <maml:para>Test-CompleterScript -Path $Path | Should -BeNullOrEmpty } } ```</maml:para> <maml:para>€</maml:para> <maml:para>Turns the conformance check into a Pester test for a completer repository.</maml:para> </maml:introduction> <dev:code /> <dev:remarks /> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Import-CompleterScript</maml:linkText> <maml:uri>Import-CompleterScript.md</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-CompleterRegistration</maml:linkText> <maml:uri>Test-CompleterRegistration.md</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command> <command:details> <command:name>Unregister-CompleterRegistration</command:name> <maml:description> <maml:para>Removes completer registrations from runtime and, when applicable, module state.</maml:para> </maml:description> <command:verb>Unregister</command:verb> <command:noun>CompleterRegistration</command:noun> </command:details> <maml:description> <maml:para>Removes completer registrations identified by registration key, native command, command parameter target, or pipeline InputObject values. Managed registrations are removed from both the PowerShell runtime and the module's registration table. Runtime-only registrations require -AllowUnmanaged before they can be removed. The same gate applies when a managed record is stale because the runtime registration was replaced outside this module: the live value is only removed with -AllowUnmanaged, and the stale managed record is dropped with it. When the runtime registration was already removed outside this module, only the stale managed record remains and it is removed without the gate. The command supports array inputs for keys and target fields, plus pipeline input from Get-CompleterRegistration output.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Unregister-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="RegistrationKey"> <maml:name>Key</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>AllowUnmanaged</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>WhatIf</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Confirm</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Unregister-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">psobject[]</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.PSObject[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>AllowUnmanaged</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>WhatIf</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Confirm</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Unregister-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>ParameterName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>AllowUnmanaged</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>WhatIf</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Confirm</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Unregister-CompleterRegistration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description /> <command:parameterValue required="true" variableLength="false">string[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Native</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>AllowUnmanaged</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>WhatIf</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none"> <maml:name>Confirm</maml:name> <maml:description /> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>AllowUnmanaged</maml:name> <maml:description> <maml:para>Allows removal of runtime registrations that are not tracked by this module.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="none"> <maml:name>CommandName</maml:name> <maml:description> <maml:para>Specifies one or more command names whose completers should be removed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="Named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Supplies one or more objects that describe registrations to remove. Input objects can expose Key, RegistrationKey, RuntimeKey, or CommandName/ParameterName plus IsNative/Native.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.Management.Automation.PSObject[]</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.PSObject[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="RegistrationKey"> <maml:name>Key</maml:name> <maml:description> <maml:para>Removes the registrations that match one or more registration keys.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="IsNative"> <maml:name>Native</maml:name> <maml:description> <maml:para>Targets native completer registrations instead of command parameter completers.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="Named" aliases="none"> <maml:name>ParameterName</maml:name> <maml:description> <maml:para>Specifies one or more parameter names for command-parameter completer removal targets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">System.String[]</command:parameterValue> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns the registration records that were removed.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="Named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Runs the command in a mode that only reports what would happen without performing the actions.</maml:para> </maml:description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.PSObject[]</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSCustomObject</maml:name> </dev:type> <maml:description> <maml:para>When -PassThru is used</maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSObject</maml:name> </dev:type> <maml:description> <maml:para /> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para /> </maml:alert> </maml:alertSet> <command:examples /> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>text</maml:linkText> <maml:uri>https://github.com/tstager/CompleterActions/blob/deae4ca162751c60861237e1d2825f9b0f1fd0ff/src/docs/CompleterActions/Unregister-CompleterRegistration.md</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> </helpItems> |