Skip to content

Commit 153f731

Browse files
authored
Merge pull request #3042 from cmderdev/copilot/fix-and-optimize-cmder-ps1
Refactor Cmder.ps1: Apply PowerShell naming conventions and optimize code
2 parents 3172771 + 697c122 commit 153f731

File tree

2 files changed

+189
-117
lines changed

2 files changed

+189
-117
lines changed

vendor/profile.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ if (-not $moduleInstallerAvailable -and -not $env:PSModulePath.Contains($CmderMo
4444
}
4545

4646
# Read vendored Git Version
47-
$gitVersionVendor = (readGitVersion -gitPath "$ENV:CMDER_ROOT\vendor\git-for-windows\cmd")
47+
$gitVersionVendor = Get-GitVersion -GitPath "$ENV:CMDER_ROOT\vendor\git-for-windows\cmd"
4848
Write-Debug "GIT VENDOR: ${gitVersionVendor}"
4949

5050
# Get user installed Git version(s) if found, and compare them with vendored version.
5151
foreach ($git in (Get-Command -ErrorAction SilentlyContinue 'git')) {
5252
Write-Debug "GIT PATH: {$git.Path}"
5353
$gitDir = Split-Path -Path $git.Path
54-
$gitDir = isGitShim -gitPath $gitDir
55-
$gitVersionUser = (readGitVersion -gitPath $gitDir)
54+
$gitDir = Get-GitShimPath -GitPath $gitDir
55+
$gitVersionUser = Get-GitVersion -GitPath $gitDir
5656
Write-Debug "GIT USER: ${gitVersionUser}"
5757

58-
$useGitVersion = compare_git_versions -userVersion $gitVersionUser -vendorVersion $gitVersionVendor
58+
$useGitVersion = Compare-GitVersion -UserVersion $gitVersionUser -VendorVersion $gitVersionVendor
5959
Write-Debug "Using Git Version: ${useGitVersion}"
6060

6161
# Use user installed Git
@@ -85,7 +85,7 @@ Write-Debug "GIT_INSTALL_ROOT: ${ENV:GIT_INSTALL_ROOT}"
8585
Write-Debug "GIT_INSTALL_TYPE: ${ENV:GIT_INSTALL_TYPE}"
8686

8787
if ($null -ne $ENV:GIT_INSTALL_ROOT) {
88-
$env:Path = Configure-Git -gitRoot "$ENV:GIT_INSTALL_ROOT" -gitType $ENV:GIT_INSTALL_TYPE -gitPathUser $gitPathUser
88+
$env:Path = Set-GitPath -GitRoot "$ENV:GIT_INSTALL_ROOT" -GitType $ENV:GIT_INSTALL_TYPE -GitPathUser $gitPathUser
8989
}
9090

9191
# Create 'vi' alias for 'vim' if vim is available
@@ -130,7 +130,7 @@ $env:gitLoaded = $null
130130
$Host.UI.RawUI.ForegroundColor = "White"
131131
Microsoft.PowerShell.Utility\Write-Host "PS " -NoNewline -ForegroundColor $color
132132
Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green
133-
checkGit($pwd.ProviderPath)
133+
Show-GitStatus -Path $pwd.ProviderPath
134134
Microsoft.PowerShell.Utility\Write-Host "`nλ" -NoNewLine -ForegroundColor "DarkGray"
135135
}
136136

0 commit comments

Comments
 (0)