# LibTmux.Workspace\Import-TmuxWorkspace

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

```
File:
Import-TmuxWorkspace
    -File <System.IO.FileInfo>
    [<CommonParameters>]

Path (default):
Import-TmuxWorkspace
    [-LiteralPath] <System.String>
    [<CommonParameters>]

Yaml:
Import-TmuxWorkspace
    -Yaml <System.String>
    [<CommonParameters>]
```

Parse a workspace declaration without executing it.

Read a literal filesystem path, a [`FileInfo`](https://learn.microsoft.com/dotnet/api/system.io.fileinfo) pipeline or supplied YAML/JSON text
into a native WorkspaceFile. [`Inputs`](/en/csharp/latest/reference/libtmux-commandpromptrequest-inputs/) must be seekable UTF-8 files; a UTF-8 BOM
is accepted. Named pipes are rejected without waiting for a writer.
Admission stops at 1048576 characters, before retaining an oversized document.
Malformed YAML/JSON and invalid UTF-8 preserve their exceptions as InvalidData
errors.

Parsing does not start tmux, execute host scripts or expand paths and variables.
[`Resolve-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-resolve-tmuxworkspace/) supplies an explicit document base and allowed variables.
[`Test-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-test-tmuxworkspace/) checks declaration completeness and execution policy.

A window can set `window_index` to a nonnegative session-relative index. Omit
it for tmux's next free index. Duplicate requested indexes fail validation;
an index already occupied in the session fails during application.

### Notes

File errors retain [`Tmux.InvalidWorkspace`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux.Workspace/Import-TmuxWorkspace.md#notes) and allow later pipeline files with
[`ErrorAction`](/en/powershell/latest/workspace/reference/libtmux-workspace-import-tmuxworkspace/#LibTmux.Workspace%5CImport-TmuxWorkspace.parameter.ErrorAction) Continue. [`ErrorAction`](/en/powershell/latest/workspace/reference/libtmux-workspace-import-tmuxworkspace/#LibTmux.Workspace%5CImport-TmuxWorkspace.parameter.ErrorAction) Stop terminates. No form applies a workspace.

## Command details

- **Command type:** [`cmdlet`](/en/powershell/latest/workspace/reference/glossary/#cmdlet)
- **Default parameter set:** Path
- **Positional binding:** Enabled.
- **Pipeline inputs:** `System.IO.FileInfo`: A file to read and parse.
- **Outputs:** `LibTmux.Workspace.WorkspaceFile`

Related APIs:

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

## Examples

Example 1

Inspect a declaration with a window at index 5 without starting tmux.

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

```powershell
LibTmux.Workspace\Import-TmuxWorkspace -Yaml @'
session_name: development
windows:
  - window_name: editor
    window_index: 5
    panes: [null]
'@
```

## Parameters

- `File` (`System.IO.FileInfo`): A FileInfo returned by Get-Item or workspace discovery. Its path is literal. (for `File`)
  Required. Named parameter. Accepts pipeline input by value. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?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`.
- `LiteralPath` (`System.String`): The literal file path to read. (for `Path`)
  Required. Position 0. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0).
- `Yaml` (`System.String`): YAML or JSON declaration text. (for `Yaml`)
  Required. Named parameter. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0).

## Returns

`LibTmux.Workspace.WorkspaceFile`: Native pipeline type for this command.
