# LibTmux\Get-TmuxQueryPlan

- **Package:** LibTmux
- **Language:** PowerShell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/src/LibTmux.PowerShell/GetTmuxQueryPlanCommand.cs#L7
- **Page:** https://libtmux.org/en/powershell/latest/reference/libtmux-get-tmuxqueryplan/

```
Get-TmuxQueryPlan
    [-Query] <LibTmux.Query.QueryDocument>
    -DaemonVersion <LibTmux.TmuxVersion>
    [-Pushdown <LibTmux.Query.QueryPushdown>]
    [<CommonParameters>]
```

Inspect how a query will run against a known tmux version.

Prepare a native query plan without contacting tmux. The plan exposes pushed
and residual predicates, required fields, snapshot depth and fallback reasons.
Displaying the plan or reading its properties performs no I/O. Pass it to
[`Invoke-TmuxQuery`](/en/powershell/latest/reference/libtmux-invoke-tmuxquery/) with an explicit server to execute it.

[`Auto`](/en/csharp/latest/reference/libtmux-query-querypushdown-auto/) evaluates supported conditions inside tmux and the remainder locally.
[`Never`](/en/csharp/latest/reference/libtmux-query-querypushdown-never/) evaluates the complete predicate locally. [`Require`](/en/csharp/latest/reference/libtmux-query-querypushdown-require/) rejects predicates
that need local evaluation. [`All`](/en/csharp/latest/reference/libtmux-unbindkeyrequest-all/) modes retain the complete acquired graph;
source evaluation does not reduce the captured rows.

### Notes

Invalid or unsupported planning terminates with [`Tmux.QueryPlanFailed`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Get-TmuxQueryPlan.md#notes). Planning does not discover the installed client or daemon version.

## Command details

- **Command type:** [`cmdlet`](/en/powershell/latest/reference/glossary/#cmdlet)
- **Positional binding:** Enabled.
- **Pipeline inputs:** `LibTmux.Query.QueryDocument`: A query document.
- **Outputs:** `LibTmux.Query.QueryPlan[LibTmux.Session]`, `LibTmux.Query.QueryPlan[LibTmux.Window]`, `LibTmux.Query.QueryPlan[LibTmux.Pane]`

Related APIs:

- [`New-TmuxQuery`](/en/powershell/latest/reference/libtmux-new-tmuxquery/)
- [`Invoke-TmuxQuery`](/en/powershell/latest/reference/libtmux-invoke-tmuxquery/)

## Examples

Example 1

Prepare an exact pane-ID query for tmux 3.2a without opening a connection.
Use the observed daemon version when preparing a plan for execution.

[Source example](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Get-TmuxQueryPlan.md).

```powershell
$version = [LibTmux.TmuxVersion]::Parse('3.2a')
LibTmux\New-TmuxQuery -Target Pane -Criteria @{ Id = '%0' } |
    LibTmux\Get-TmuxQueryPlan -DaemonVersion $version -Pushdown Require
```

## Parameters

- `Query` (`LibTmux.Query.QueryDocument`): A native Session, Window or Pane document.
  Required. Position 0. Accepts pipeline input by value. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?view=powershellsdk-7.4.0).
- `DaemonVersion` (`LibTmux.TmuxVersion`): The known daemon version. Execution verifies it against the selected endpoint.
  Required. Named parameter. Does not accept pipeline input.
- `Pushdown` (`LibTmux.Query.QueryPushdown`): Where predicates may be evaluated. Require concerns predicate evaluation; parsing and object construction still occur locally.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `Auto`. [`ValidateSet(["Auto","Never","Require"])`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatesetattribute?view=powershellsdk-7.4.0).
- `Verbose` (`System.Management.Automation.SwitchParameter`): Display verbose messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `vb`.
- `Debug` (`System.Management.Automation.SwitchParameter`): Display debug messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `db`.
- `ErrorAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to non-terminating errors.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ea`.
- `WarningAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to warning messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wa`.
- `InformationAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles information messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `infa`.
- `ProgressAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles progress updates.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `proga`.
- `ErrorVariable` (`System.String`): Store the command's error records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ev`.
- `WarningVariable` (`System.String`): Store the command's warning records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wv`.
- `InformationVariable` (`System.String`): Store the command's information records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `iv`.
- `OutVariable` (`System.String`): Save output in the named variable while passing it down the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ov`.
- `OutBuffer` (`System.Int32`): Buffer output before passing it to the next pipeline command.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ob`.
- `PipelineVariable` (`System.String`): Make the most recent output object available through a named variable within the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `pv`.

## Returns

`LibTmux.Query.QueryPlan<T>`: One native plan targeting Session, Window or Pane.
