Skip to content

Display location depth in prompt #570

Discussion options

You must be logged in to vote

You can make use of the environment segment and use Set-PoshContext to add the stack count to an environment variable.

function Set-EnvVar {
    $env:STACK_COUNT = '$(''+'' * ((get-location -stack).count))'
}

New-Alias -Name 'Set-PoshContext' -Value 'Set-EnvVar' -Scope Global

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dpokluda
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants