# LibTmux.Workspace\Get-TmuxWorkspace

- **Package:** LibTmux.Workspace
- **Language:** PowerShell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/src/LibTmux.Workspace.PowerShell/GetTmuxWorkspaceCommand.cs#L8
- **Page:** https://libtmux.org/en/powershell/latest/workspace/reference/libtmux-workspace-get-tmuxworkspace/

```
Directory:
Get-TmuxWorkspace
    -Directory <System.String>
    [<CommonParameters>]

Discover (default):
Get-TmuxWorkspace
    [-ConfigurationDirectory <System.String>]
    [-AllLocations]
    [<CommonParameters>]

LiteralPath:
Get-TmuxWorkspace
    -LiteralPath <System.String>
    [<CommonParameters>]

Name:
Get-TmuxWorkspace
    [-Name] <System.String>
    [-ConfigurationDirectory <System.String>]
    [-AllLocations]
    [<CommonParameters>]

Search:
Get-TmuxWorkspace
    [-ConfigurationDirectory <System.String>]
    [-AllLocations]
    -Search <System.String>
    [-SearchIn <System.String[]>]
    [-CaseSensitive]
    [<CommonParameters>]
```

Find workspace declaration files without loading sessions.

Return native [`FileInfo`](https://learn.microsoft.com/dotnet/api/system.io.fileinfo) objects for readable, seekable declaration files.
Discovery does not contact tmux, run scripts, resolve declaration variables or
create configuration directories. Pipe a selected file to [`Import-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-import-tmuxworkspace/)
for parsing, or [`Resolve-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-resolve-tmuxworkspace/) for explicit file-relative resolution.

With no arguments, list .tmuxp.yaml, .tmuxp.yml and .tmuxp.json in the current
filesystem directory, then each ancestor through HOME when it is an ancestor,
otherwise through the filesystem root. Each directory uses that extension
order. Append files from the first existing global configuration directory:
ConfigurationDirectory, TMUXP_CONFIGDIR, XDG_CONFIG_HOME/tmuxp (or
HOME/.config/tmuxp), then HOME/.tmuxp. HOME falls back to the platform user
profile directory when unset. Missing default locations are skipped; an
explicit missing ConfigurationDirectory is an error. AllLocations includes
all existing global candidates in that order, preserving shadowed files.
Global filenames sort ordinally within each location. Repeated full paths
are emitted once.

Directory checks only the three local .tmuxp filenames in that exact directory.
LiteralPath selects one exact filesystem file and bypasses discovery; it has
no extension restriction. File symlinks retain their literal paths when the
shared opener accepts the target. Directory entries are not files and are
never recursively descended, including directory symlinks.

Name searches only the selected global locations. It is a literal basename,
with an optional .yaml, .yml or .json suffix. Without a supported suffix, those
three suffixes are tried in order. Multiple matches in one location are an
ambiguity error naming the candidates; use LiteralPath to choose. A missing
name emits no objects. Path separators are rejected; wildcard characters are
literal. Filename suffixes are lowercase and literal; path/name identity
follows the filesystem, independently of search case behavior.

[`Search`](/en/csharp/latest/reference/libtmux-prompttype-search/) uses literal ordinal-ignore-case substring matching on filenames by
default. CaseSensitive selects ordinal matching. SearchIn selects FileName,
Path, [`Session`](/en/csharp/latest/reference/libtmux-session/), [`Window`](/en/csharp/latest/reference/libtmux-window/), Command or Directory fields. Path searches the full
selected path without reading file content. Any content field
parses every candidate with the shared strict UTF-8 reader, accepting a UTF-8
BOM and at most 1048576 characters. Command includes before_script and all
pane commands and shell_command_before entries; none are executed. Directory
searches declared strings without expansion. Multiple fields combine by OR.
Malformed candidate data fails content search even if its filename matches.

Traversal stops with an error after 1024 examined entries: existing local
marker probes and global directory entries count, including unselected suffixes
and directories. Ancestor traversal also has a 1024-directory ceiling. Narrow
the request with Directory, Name or LiteralPath. Results are published only
after successful discovery/search, so failures do not emit truncated lists.
Filesystem contents can change between discovery and later import; [`FileInfo`](https://learn.microsoft.com/dotnet/api/system.io.fileinfo)
output is not a locked or atomic filesystem snapshot.

### Notes

Failures write [`Tmux.WorkspaceDiscoveryFailed`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux.Workspace/Get-TmuxWorkspace.md#notes) with the request as TargetObject.
File read/parse errors retain the original exception and identify the failing
path in Exception.Data['WorkspacePath']. Use [`ErrorAction`](/en/powershell/latest/workspace/reference/libtmux-workspace-get-tmuxworkspace/#LibTmux.Workspace%5CGet-TmuxWorkspace.parameter.ErrorAction) Stop to terminate.
Cancellation is checked between traversal, read and search operations and
before publication. Stopping discovery does not delete files or stop a daemon.

## Command details

- **Command type:** [`cmdlet`](/en/powershell/latest/workspace/reference/glossary/#cmdlet)
- **Default parameter set:** Discover
- **Positional binding:** Enabled.
- **Pipeline inputs:** `None`: No pipeline input.
- **Outputs:** `System.IO.FileInfo`

Related APIs:

- [`Import-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-import-tmuxworkspace/)
- [`Resolve-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-resolve-tmuxworkspace/)

## Examples

Example 1

Select the existing declaration named by $WorkspacePath, retaining a native
FileInfo that can feed Import-TmuxWorkspace or Resolve-TmuxWorkspace.

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

```powershell
LibTmux.Workspace\Get-TmuxWorkspace -LiteralPath $WorkspacePath
```

## Parameters

- `Directory` (`System.String`): One existing directory whose local .tmuxp declaration filenames are checked. (for `Directory`)
  Required. Named parameter. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?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`.
- `ConfigurationDirectory` (`System.String`): The first global directory candidate. An explicitly supplied missing directory is an error. (for `Discover`; `Name`; `Search`)
  Optional. Named parameter. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0).
- `AllLocations` (`System.Management.Automation.SwitchParameter`): Include every existing global location in precedence order instead of only the first. (for `Discover`; `Name`; `Search`)
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Documented default: `False`.
- `LiteralPath` (`System.String`): One literal FileSystem path. Other providers and directories are rejected. (for `LiteralPath`)
  Required. Named parameter. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0).
- `Name` (`System.String`): A literal global declaration basename, optionally ending in .yaml, .yml or .json. (for `Name`)
  Required. Position 0. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0).
- `Search` (`System.String`): Literal substring text, from 1 through 4096 characters. No regex or wildcard interpretation. (for `Search`)
  Required. Named parameter. Does not accept pipeline input. [`ValidateLength(1, 4096)`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatelengthattribute?view=powershellsdk-7.4.0). [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0).
- `SearchIn` (`System.String[]`): Fields to search. Any declaration field explicitly opts into bounded parsing of all candidates. (for `Search`)
  Optional. Named parameter. Does not accept pipeline input. Documented default: `FileName`. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0). [`ValidateCount(1, 6)`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatecountattribute?view=powershellsdk-7.4.0). [`ValidateSet(["FileName","Path","Session","Window","Command","Directory"])`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatesetattribute?view=powershellsdk-7.4.0).
- `CaseSensitive` (`System.Management.Automation.SwitchParameter`): Use ordinal case-sensitive substring matching. This does not change path or name identity. (for `Search`)
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Documented default: `False`.

## Returns

`System.IO.FileInfo`: Declaration files in documented precedence order.
