Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 

Repository files navigation

git-pwsh

Provide status prompt and completion for PowerShell Core
Based mainly on Bash completion from Git
Currently does not support completion for gitk and git svn

How to use

  1. Clone the repository to the user modules directory:
Push-Location "$(Split-Path -Parent $PROFILE)/Modules"
git clone https://github.com/kwkam/git-pwsh.git
Pop-Location
  1. Put following lines after prompt function in profile.ps1:
<# ... #>
# customise prompt string
$PromptPrefix = {
    $u = [Environment]::UserName
    $h = [Environment]::MachineName
    $w = $PWD.Path.Replace($HOME, '~')
    "PS `e[0;33m$u@$h`e[m `e[0;36m$w`e[m"
}
$PromptSuffix = {
    "`n`e[1;30m$NestedPromptLevel`e[m> "
}
function Prompt
{
    "$($PromptPrefix.Invoke())$($PromptSuffix.Invoke())"
}
<# ... #>
# load git-pwsh and config
Import-Module git-pwsh
$GIT_PS1.DESCRIBE_STYLE = 'branch'
$GIT_PS1.SHOWDIRTYSTATE = $true
$GIT_PS1.SHOWSTASHSTATE = $true
$GIT_PS1.SHOWUNTRACKEDFILES = $true
$GIT_PS1.SHOWUPSTREAM.ENABLE = $true
$GIT_PS1.SHOWUPSTREAM.VERBOSE = $true
$GIT_PS1.SHOWCOLORHINTS = $true

About

A clone of git-completion.bash/git-prompt.sh for pwsh (PowerShell Core)

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages