Merge branch 'master' of https://github.com/cmderdev/cmder into development

This commit is contained in:
David Refoua
2025-11-06 17:37:49 +03:30
7 changed files with 54 additions and 36 deletions

View File

@@ -19,7 +19,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job # Steps represent a sequence of tasks that will be executed as part of the job
steps: steps:
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it # Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
- uses: actions/checkout@v4 - uses: actions/checkout@v5
with: with:
fetch-depth: 0 # fetch all history for all branches and tags fetch-depth: 0 # fetch all history for all branches and tags

View File

@@ -35,7 +35,7 @@ jobs:
discussions: write discussions: write
steps: steps:
- name: Check out repository code (Action from GitHub) - name: Check out repository code (Action from GitHub)
uses: actions/checkout@v4 uses: actions/checkout@v5
with: with:
fetch-depth: 0 fetch-depth: 0
@@ -93,26 +93,26 @@ jobs:
name: cmder_wt_mini.zip name: cmder_wt_mini.zip
- name: Upload artifact (cmder.zip) - name: Upload artifact (cmder.zip)
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
path: build/cmder.zip path: build/cmder.zip
name: cmder.zip name: cmder.zip
if-no-files-found: error if-no-files-found: error
- name: Upload artifact (cmder.7z) - name: Upload artifact (cmder.7z)
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
path: build/cmder.7z path: build/cmder.7z
name: cmder.7z name: cmder.7z
- name: Upload artifact (cmder_mini.zip) - name: Upload artifact (cmder_mini.zip)
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
path: build/cmder_mini.zip path: build/cmder_mini.zip
name: cmder_mini.zip name: cmder_mini.zip
- name: Upload artifact (hashes.txt) - name: Upload artifact (hashes.txt)
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
path: build/hashes.txt path: build/hashes.txt
name: hashes.txt name: hashes.txt

View File

@@ -45,11 +45,11 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v5
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v3 uses: github/codeql-action/init@v4
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,6 +68,6 @@ jobs:
run: .\build.ps1 -Compile -verbose run: .\build.ps1 -Compile -verbose
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3 uses: github/codeql-action/analyze@v4
with: with:
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"

View File

@@ -38,7 +38,7 @@ jobs:
continue-on-error: false continue-on-error: false
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Initialize vendors - name: Initialize vendors
shell: pwsh shell: pwsh
working-directory: scripts working-directory: scripts

View File

@@ -24,7 +24,7 @@ jobs:
pull-requests: write pull-requests: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
with: with:
fetch-depth: 0 fetch-depth: 0

49
vendor/git-prompt.sh vendored
View File

@@ -1,24 +1,33 @@
# Returns 1 if git status for Cmder is disabled, otherwise returns 0
function getGitStatusSetting() { function getGitStatusSetting() {
gitStatusSetting=$(git --no-pager config -l 2>/dev/null) local gitConfig
if [[ -n ${gitStatusSetting} ]] && [[ ${gitStatusSetting} =~ cmder.status=false ]] || [[ ${gitStatusSetting} =~ cmder.shstatus=false ]] # Get all git config entries for the current repository without pager
gitConfig=$(git --no-pager config -l 2>/dev/null) || return 0 # treat failure as enabled
# Check if git status for Cmder is disabled
if [[ $gitConfig =~ (^|$'\n')cmder\.status=false($|$'\n') ]] || \
[[ $gitConfig =~ (^|$'\n')cmder\.shstatus=false($|$'\n') ]]
then then
echo false return 1 # disabled
else
echo true
fi fi
return 0
} }
# Prints current branch or detached HEAD short commit hash
function getSimpleGitBranch() { function getSimpleGitBranch() {
gitDir=$(git rev-parse --git-dir 2>/dev/null) local gitDir
if [ -z "$gitDir" ]; then gitDir=$(git rev-parse --git-dir 2>/dev/null) || return 0
return 0
fi
headContent=$(< "$gitDir/HEAD") local headFile="$gitDir/HEAD"
if [[ "$headContent" == "ref: refs/heads/"* ]] [ -f "$headFile" ] || return 0
local headContent
headContent=$(< "$headFile")
if [[ "$headContent" =~ ^ref:\ refs/heads/(.+)$ ]]
then then
echo " (${headContent:16})" echo " (${BASH_REMATCH[1]})"
else else
echo " (HEAD detached at ${headContent:0:7})" echo " (HEAD detached at ${headContent:0:7})"
fi fi
@@ -33,18 +42,18 @@ fi
if test -f ~/.config/git/git-prompt.sh if test -f ~/.config/git/git-prompt.sh
then then
if [[ $(getGitStatusSetting) == true ]] if getGitStatusSetting
then then
. ~/.config/git/git-prompt.sh . ~/.config/git/git-prompt.sh
fi fi
else else
# Taken from https://github.com/git-for-windows/build-extra/blob/main/git-extra/git-prompt.sh # Taken parts from https://github.com/git-for-windows/build-extra/blob/main/git-extra/git-prompt.sh
PS1='\[\033]0;$TITLEPREFIX:${PWD//[^[:ascii:]]/?}\007\]' # set window title PS1='\[\033]0;${TITLEPREFIX:+$TITLEPREFIX:}${PWD//[^[:ascii:]]/?}\007\]' # set window title to TITLEPREFIX (if set) and current working directory
# PS1="$PS1"'\n' # new line (disabled) # PS1="$PS1"'\n' # new line (disabled)
PS1="$PS1"'\[\033[32m\]' # change to green PS1="$PS1"'\[\033[32m\]' # change to green and bold
PS1="$PS1"'\u@\h ' # user@host<space> PS1="$PS1"'\u@\h ' # user@host<space>
PS1="$PS1${MSYSTEM:+\[\033[35m\]$MSYSTEM }" # show MSYSTEM in purple (if set) PS1="$PS1${MSYSTEM:+\[\033[35m\]$MSYSTEM }" # show MSYSTEM in purple (if set)
PS1="$PS1"'\[\033[33m\]' # change to brownish yellow PS1="$PS1"'\[\033[1;33m\]' # change to dark yellow in bold
PS1="$PS1"'\w' # current working directory PS1="$PS1"'\w' # current working directory
if test -z "$WINELOADERNOEXEC" if test -z "$WINELOADERNOEXEC"
then then
@@ -55,7 +64,7 @@ else
if test -f "$COMPLETION_PATH/git-prompt.sh" if test -f "$COMPLETION_PATH/git-prompt.sh"
then then
. "$COMPLETION_PATH/git-completion.bash" . "$COMPLETION_PATH/git-completion.bash"
if [[ $(getGitStatusSetting) == true ]] if getGitStatusSetting
then then
. "$COMPLETION_PATH/git-prompt.sh" . "$COMPLETION_PATH/git-prompt.sh"
PS1="$PS1"'\[\033[36m\]' # change color to cyan PS1="$PS1"'\[\033[36m\]' # change color to cyan
@@ -66,9 +75,11 @@ else
fi fi
fi fi
fi fi
PS1="$PS1"'\[\033[0m\]' # change color PS1="$PS1"'\[\033[0m\]' # reset color
PS1="$PS1"'\n' # new line PS1="$PS1"'\n' # new line
PS1="$PS1"'\[\033[30;1m\]' # change color to grey in bold
PS1="$PS1"'λ ' # prompt: Cmder uses λ PS1="$PS1"'λ ' # prompt: Cmder uses λ
PS1="$PS1"'\[\033[0m\]' # reset color
fi fi
MSYS2_PS1="$PS1" # for detection by MSYS2 SDK's bash.basrc MSYS2_PS1="$PS1" # for detection by MSYS2 SDK's bash.basrc

View File

@@ -127,11 +127,18 @@ exit /b
exit /b exit /b
:toolong :toolong
echo "%OLD_PATH%">"%temp%\cmder_lib_pathA" set "_rand=%RANDOM%"
echo "%PATH%">"%temp%\cmder_lib_pathB" if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" 2>nul 1>nul
fc /b "%temp%\cmder_lib_pathA" "%temp%\cmder_lib_pathB" 2>nul 1>nul if exist "%temp%\%_rand%_cmder_lib_pathB" del "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul
if errorlevel 1 ( del "%temp%\cmder_lib_pathA" & del "%temp%\cmder_lib_pathB" & goto :changed ) if exist "%temp%\%_rand%_cmder_lib_pathA" goto :toolong
del "%temp%\cmder_lib_pathA" & del "%temp%\cmder_lib_pathB" if exist "%temp%\%_rand%_cmder_lib_pathB" goto :toolong
echo "%OLD_PATH%">"%temp%\%_rand%_cmder_lib_pathA"
if errorlevel 1 ( if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" & goto :toolong )
echo "%PATH%">"%temp%\%_rand%_cmder_lib_pathB"
if errorlevel 1 ( if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" & if exist "%temp%\%_cmder_lib_pathB" del "%temp%\%_rand%_cmder_lib_pathB" & goto :toolong )
fc /b "%temp%\%_rand%_cmder_lib_pathA" "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul
if errorlevel 1 ( del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand=" & goto :changed )
del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand="
exit /b exit /b
:changed :changed