use consistent indentation in init.bat

This commit is contained in:
David Refoua 2022-10-18 15:20:35 +03:30
parent 6d77c988db
commit 971483b2b7
2 changed files with 126 additions and 126 deletions

View File

@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v3
- name: Testing Clink Shell
run: |
cmd /c vendor\init.bat
cmd /c vendor\init.bat /v /d /t
- name: Testing PowerShell
run: |
PowerShell.exe -ExecutionPolicy Bypass -NoLogo -NoProfile -Command "Invoke-Expression '. ''vendor\profile.ps1'''"

32
vendor/init.bat vendored
View File

@ -2,7 +2,7 @@
set CMDER_INIT_START=%time%
:: Init Script for cmd.exe
:: Init Script for cmd.exe shell
:: Created as part of cmder project
:: !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
@ -44,6 +44,7 @@ if not defined CMDER_ROOT (
:: Remove trailing '\' from %CMDER_ROOT%
if "%CMDER_ROOT:~-1%" == "\" SET "CMDER_ROOT=%CMDER_ROOT:~0,-1%"
:: Include Cmder libraries
call "%cmder_root%\vendor\bin\cexec.cmd" /setpath
call "%cmder_root%\vendor\lib\lib_base"
call "%cmder_root%\vendor\lib\lib_path"
@ -123,7 +124,7 @@ call "%cmder_root%\vendor\lib\lib_profile"
goto var_loop
:start
:: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES
:: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES variables
%lib_base% cmder_shell
%print_debug% init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%"
%print_debug% init.bat "Env Var - debug_output=%debug_output%"
@ -134,7 +135,7 @@ if defined CMDER_USER_CONFIG (
if not exist "%CMDER_USER_CONFIG%\..\opt" md "%CMDER_USER_CONFIG%\..\opt"
)
:: Pick right version of clink
:: Pick right version of Clink
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
set clink_architecture=x86
set architecture_bits=32
@ -164,14 +165,14 @@ if "%CMDER_CLINK%" == "1" (
del "%CMDER_USER_CONFIG%\settings"
)
REM Cleanup legacy CLink history file
REM Cleanup legacy Clink history file
if exist "%CMDER_USER_CONFIG%\.history" if exist "%CMDER_USER_CONFIG%\clink_history" (
del "%CMDER_USER_CONFIG%\.history"
)
"%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor"
) else (
if not exist "%CMDER_ROOT%\config\settings" if not exist "%CMDER_ROOT%\config\clink_settings" (
echo Generating clink initial settings in "%CMDER_ROOT%\config\clink_settings"
echo Generating Clink initial settings in "%CMDER_ROOT%\config\clink_settings"
copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\clink_settings"
echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup.
)
@ -209,10 +210,7 @@ if "%CMDER_CONFIGURED%" GTR "1" (
:: Prepare for git-for-windows
:: I do not even know, copypasted from their .bat
set PLINK_PROTOCOL=ssh
:: The idea:
:: Detect which git.exe version to use
:: * if the users points as to a specific git, use that
:: * test if a git is in path and if yes, use that
:: * last, use our vendored git
@ -228,13 +226,13 @@ if defined GIT_INSTALL_ROOT (
%print_debug% init.bat "Looking for Git install root..."
:: get the version information for vendored git binary
:: Get the version information for vendored git binary
%lib_git% read_version VENDORED "%CMDER_ROOT%\vendor\git-for-windows\cmd" 2>nul
%lib_git% validate_version VENDORED %GIT_VERSION_VENDORED%
:: check if git is in path...
:: Check if git is in path
for /F "delims=" %%F in ('where git.exe 2^>nul ^| find "\cmd\git.exe"') do (
:: get the absolute path to the user provided git binary
:: Get the absolute path to the user provided git binary
%lib_git% is_git_shim "%%~dpF"
%lib_git% get_user_git_version
%lib_git% compare_git_versions
@ -244,7 +242,7 @@ for /F "delims=" %%F in ('where git.exe 2^>nul ^| find "\cmd\git.exe"') do (
)
)
:: our last hope: our own git...
:: Our last hope: use vendored git
:VENDORED_GIT
if exist "%CMDER_ROOT%\vendor\git-for-windows" (
set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
@ -267,7 +265,7 @@ goto :CONFIGURE_GIT
:: Add git to the path
if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" ""
:: Add the unix commands at the end to not shadow windows commands like more
:: Add the unix commands at the end to not shadow windows commands like more and find
if %nix_tools% equ 1 (
%print_verbose% "Preferring Windows commands"
set "path_position=append"
@ -287,7 +285,10 @@ if %nix_tools% geq 1 (
)
)
:: define SVN_SSH so we can use git svn with ssh svn repositories
:: Plink (PuTTY Link) is a command-line connection tool similar to ssh, setting its protocol to ssh
set PLINK_PROTOCOL=ssh
:: Define SVN_SSH so we can use git svn with ssh svn repositories
if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
:: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path.
@ -298,7 +299,6 @@ if not defined git_locale for /F "tokens=* delims=" %%F in ('where env.exe 2^>nu
setlocal enabledelayedexpansion
if defined git_locale (
REM %print_debug% init.bat "Env Var - git_locale=!git_locale!"
if not defined LANG (
for /F "delims=" %%F in ('!git_locale! -uU 2') do (