Kha*_*meh 12 git console powershell mercurial
您好我是Git和Hg的忠实粉丝,并且必须在许多项目中使用它们.我目前使用的是Posh-Hg,它是一个powershell插件,可以将当前分支和未完成的提交放在您的PowerShell中.Posh-Git以类似的方式运行,除了Git.有没有人成功获得两个PowerShell脚本一起玩得很好?
rod*_*dpl 19
在您的个人资料脚本中尝试这个:
function isCurrentDirectoryARepository($type) {
if ((Test-Path $type) -eq $TRUE) {
return $TRUE
}
# Test within parent dirs
$checkIn = (Get-Item .).parent
while ($checkIn -ne $NULL) {
$pathToTest = $checkIn.fullname + '/' + $type;
if ((Test-Path $pathToTest) -eq $TRUE) {
return $TRUE
} else {
$checkIn = $checkIn.parent
}
}
return $FALSE
}
# Posh-Hg and Posh-git prompt
. $ProfileRoot\Modules\posh-hg\profile.example.ps1
. $ProfileRoot\Modules\posh-git\profile.example.ps1
function prompt(){
# Reset color, which can be messed up by Enable-GitColors
$Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor
Write-Host($pwd) -nonewline
if (isCurrentDirectoryARepository(".git")) {
# Git Prompt
$Global:GitStatus = Get-GitStatus
Write-GitStatus $GitStatus
} elseif (isCurrentDirectoryARepository(".hg")) {
# Mercurial Prompt
$Global:HgStatus = Get-HgStatus
Write-HgStatus $HgStatus
}
return "> "
}
Run Code Online (Sandbox Code Playgroud)
Mik*_*liy 11
请注意,该问题现已修复.假设您拥有Posh-Hg和Posh-Git的最新版本,您的个人资料应仅包括在内.
# Posh-Hg and Posh-git prompt
. $ProfileRoot\Modules\posh-hg\profile.example.ps1
. $ProfileRoot\Modules\posh-git\profile.example.ps1
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1725 次 |
| 最近记录: |