This is my ConsoleZ powershell that I wanted to have a posh-git environment also, but doesn't work.
This line of code is inside the Microsoft PowerShell profile
Write-Host "Setting up GitHub Environment"
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1")
Write-Host "Setting up Posh-Git"
. (Resolve-Path "$env:github_posh_git\profile.example.ps1")
function prompt {
$p = Split-Path -leaf -path (Get-Location)
"$p> "
}
I have been trying a couple of time now, posh-git won't integrate on to my consoleZ.
The problem is it won't run posh-git after putting all the scripts needed in the $profile.
I can't get it to be like this.
UPDATE
Burt_Harris comment was right, it was because of the prompt function that was messing with posh_git, now my problem is how to get the 2 functions working?
UPDATE 2
My script to combine the two prompt functions. just give me PS> instead of folder directory>
# Prompt for shortened link on command line
function myPrompt {
$p = Split-Path -leaf -path (Get-Location)
"$p> "
}
$myPrompt = $function:myPrompt
# Set up a simple prompt, adding the git prompt parts inside git repos
function posh_gitPrompt {
$realLASTEXITCODE = $LASTEXITCODE
Write-Host($pwd.ProviderPath) -nonewline
Write-VcsStatus
$global:LASTEXITCODE = $realLASTEXITCODE
return "> "
}
# Combine myPrompt & posh_gitPrompt
function global:prompt {
"myPrompt`n$(&$posh_gitPrompt)"
}
SOLUTION
Instead of using this
Write-Host($pwd.ProviderPath) -nonewline
on the posh_git example profile, I modified it to
Write-Host(Split-Path -leaf $pwd.ProviderPath) -nonewline
that did the trick, didn't need to make another function.
Instead of using this
Write-Host($pwd.ProviderPath) -nonewline
on the posh_git example profile, I modified it to
Write-Host(Split-Path -leaf $pwd.ProviderPath) -nonewline
that did the trick, didn't need to make another function.