Get-NBBranchContext
Since
v4.4.10.0
SYNOPSIS
Gets the current branch context.
SYNTAX
Get-NBBranchContext [-Stack] [-Full] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
Returns the name of the currently active branch context, or $null if operating in the main context (not in any branch).
EXAMPLES
EXAMPLE 1
Get-NBBranchContext
Returns the current branch name or $null.
EXAMPLE 2
if (Get-NBBranchContext) { "In branch" } else { "In main" }
Check if currently in a branch context.
EXAMPLE 3
Get-NBBranchContext -Stack
Returns all branch names in the stack.
EXAMPLE 4
Get-NBBranchContext -Full
Returns the full context object with Name, SchemaId, and Id.
PARAMETERS
-Stack
Return the entire branch stack instead of just the current branch.
```yaml Type: SwitchParameter Parameter Sets: (All) Aliases:
Required: False Position: Named Default value: False Accept pipeline input: False Accept wildcard characters: False ```
-Full
Return the full branch context object(s) including Name, SchemaId, and Id.
```yaml Type: SwitchParameter Parameter Sets: (All) Aliases:
Required: False Position: Named Default value: False Accept pipeline input: False Accept wildcard characters: False ```
-ProgressAction
{{ Fill ProgressAction Description }}
```yaml Type: ActionPreference Parameter Sets: (All) Aliases: proga
Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
OUTPUTS
[string] The current branch name, or $null if in main context.
[string[]] If -Stack is specified, returns all branch names in the stack.
[PSCustomObject] If -Full is specified, returns the current branch context object.
[PSCustomObject[]] If -Stack and -Full are specified, returns all context objects.
NOTES
AddedInVersion: v4.4.10.0