LibTmux.Workspace\ConvertTo-TmuxWorkspaceJson
- ConvertTo-TmuxWorkspaceJson [-Workspace] <LibTmux.Workspace.WorkspaceFile> [<Common
Parameters >] -
Convert a native workspace declaration to JSON text.
Description#
Return one string for each native WorkspaceFile received from the pipeline. The text uses the snake_case keys accepted by
Import-TmuxWorkspaceand the native parser. Conversion preserves pane and command order, empty strings, nullable fields, global and local options, post-construction options, environment and commands at every declaration level. It does not expand command text or inherit local defaults into children.Resolved directories and option values contain literal text. Conversion escapes their dollar signs as
$$so export, import and a later explicitResolve-TmuxWorkspacekeep the same values. Unresolved variable expressions remain unchanged. DocumentDirectory is resolution provenance and is omitted from the text; provide an explicit base when resolving the imported declaration.The native parser checks emitted text, including its character limit. This is not application validation: incomplete declarations can still be converted. No tmux observation, command execution, file writing or plan serialization occurs. Formatting and comments from an imported source document are not part of the native declaration and are not reproduced.
Notes
Serialization errors terminate with
Tmux.WorkspaceJsonFailedand retain the original exception. Null host commands are omitted because the native parser rejects an explicit null before_script. Nullable name and directory values remain distinct from empty strings. The native model does not retain a distinction between omitted and empty collections or omitted and false focus.Command details#
- Command type
cmdlet- Positional binding
- Enabled.
- Pipeline inputs
LibTmux.Workspace.WorkspaceFile: A parsed or explicitly resolved declaration.- Outputs
-
System.String
Examples#
Example 1 Convert a two-pane declaration for storage or inspection. View source
Terminal window LibTmux.Workspace\Import-TmuxWorkspace -Yaml @'session_name: developmentwindows:- window_name: workpanes: [nvim, ""]'@ | LibTmux.Workspace\ConvertTo-TmuxWorkspaceJson- Parameters
-
-
-Workspace(LibTmux.Workspace.WorkspaceFile) #The native declaration to serialize without applying it.
- Required
- Yes
- Position
- 0
- Pipeline input
- By value
- Validation
ValidateNotNull()
Common parameters 12
PowerShell supplies these parameters. See common parameter behavior for their effects.
-
-Verbose(System.Management ) #.Automation .Switch Parameter Display verbose messages produced by this command.
Aliases:vbMicrosoft Learn reference -
-Debug(System.Management ) #.Automation .Switch Parameter Display debug messages produced by this command.
Aliases:dbMicrosoft Learn reference -
-ErrorAction(System.Management ) #.Automation .Action Preference Choose how this command responds to non-terminating errors.
Aliases:eaMicrosoft Learn reference -
-WarningAction(System.Management ) #.Automation .Action Preference Choose how this command responds to warning messages.
Aliases:waMicrosoft Learn reference -
-InformationAction(System.Management ) #.Automation .Action Preference Choose how this command handles information messages.
Aliases:infaMicrosoft Learn reference -
-ProgressAction(System.Management ) #.Automation .Action Preference Choose how this command handles progress updates.
Aliases:progaMicrosoft Learn reference -
-ErrorVariable(System.String ) #Store the command's error records in the named variable.
Aliases:evMicrosoft Learn reference -
-WarningVariable(System.String ) #Store the command's warning records in the named variable.
Aliases:wvMicrosoft Learn reference -
-InformationVariable(System.String ) #Store the command's information records in the named variable.
Aliases:ivMicrosoft Learn reference -
-OutVariable(System.String ) #Save output in the named variable while passing it down the pipeline.
Aliases:ovMicrosoft Learn reference -
Buffer output before passing it to the next pipeline command.
Aliases:obMicrosoft Learn reference -
-PipelineVariable(System.String ) #Make the most recent output object available through a named variable within the pipeline.
Aliases:pvMicrosoft Learn reference
-
- Returns
-
System.String:OneJSON document per input declaration.
Discussed in Workspace guide