adjust indentation and merge from main

This commit is contained in:
David Refoua 2024-10-17 19:46:22 +03:30
commit 4740b836f3
2 changed files with 24 additions and 18 deletions

View File

@ -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"
@ -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 (

View File

@ -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")
@ -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!"
}
}