Skip to content

Commit

Permalink
adjust indentation and merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSDavidSoft committed Oct 17, 2024
2 parents fbd4c04 + e220d11 commit 4740b83
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
7 changes: 6 additions & 1 deletion vendor/lib/lib_git.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ exit /b
:::===============================================================================
:::is_git_shim - Check if the directory has a git.shim file
:::.
:::description:
:::.
::: Shim is a small helper program for Scoop that calls the executable configured in git.shim file
::: See: github.com/ScoopInstaller/Shim and github.com/cmderdev/cmder/pull/1905
:::.
:::include:
:::.
::: call "$0"
Expand All @@ -202,7 +207,7 @@ exit /b

:is_git_shim
pushd "%~1"
:: check if there's shim - and if yes follow the path
:: check if there is a shim file - if yes, read the actual executable path
setlocal enabledelayedexpansion
if exist git.shim (
for /F "tokens=2 delims== " %%I in (git.shim) do (
Expand Down
35 changes: 18 additions & 17 deletions vendor/psmodules/Cmder.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ function readVersion($gitPath) {
}

function isGitShim($gitPath) {
# check if there's shim - and if yes follow the path
# check if there is a shim file - if yes, read the actual executable path
# See: github.com/ScoopInstaller/Shim

if (Test-Path "${gitPath}\git.shim") {
$shim = (get-content "${gitPath}\git.shim")
Expand Down Expand Up @@ -178,27 +179,27 @@ function getGitStatusSetting() {
}

function yOrn( $question ) {
Do {
$Answer = Read-Host -Prompt "`n${question}? (y/n) "
}
Until ($Answer -eq 'y' -or $Answer -eq 'n' -or $Answer -eq 'yes' -or $Answer -eq 'no')
Do {
$Answer = Read-Host -Prompt "`n${question}? (y/n) "
}
Until ($Answer -eq 'y' -or $Answer -eq 'n' -or $Answer -eq 'yes' -or $Answer -eq 'no')

return $Answer
return $Answer
}

function templateExpand($template_filename, $outfile) {
$template = Get-Content "$template_filename" -Raw
$template = Get-Content "$template_filename" -Raw

$expanded = Invoke-Expression "@`"`r`n$template`r`n`"@"
$expanded = Invoke-Expression "@`"`r`n$template`r`n`"@"

$overwrite = 'y'
if ((test-path "$outfile")) {
$overwrite = yOrn "'$outfile' already exists do you want to overwrite it"
}
$overwrite = 'y'
if ((test-path "$outfile")) {
$overwrite = yOrn "'$outfile' already exists do you want to overwrite it"
}

if ($overwrite -match 'y') {
$expanded | out-file -ErrorAction silentlycontinue -encoding ascii "$outfile"
} else {
write-host "Skipping Cmder '$shell' config generation at user request!"
}
if ($overwrite -match 'y') {
$expanded | out-file -ErrorAction silentlycontinue -encoding ascii "$outfile"
} else {
write-host "Skipping Cmder '$shell' config generation at user request!"
}
}

0 comments on commit 4740b83

Please sign in to comment.