mirror of
https://github.com/cmderdev/cmder.git
synced 2025-11-08 21:29:02 +08:00
Compare commits
2 Commits
copilot/su
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d17a2f4cb | ||
|
|
5c072d47e4 |
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@@ -53,26 +53,26 @@ jobs:
|
|||||||
run: .\pack.ps1 -verbose
|
run: .\pack.ps1 -verbose
|
||||||
|
|
||||||
- name: Upload artifact (cmder.zip)
|
- name: Upload artifact (cmder.zip)
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v4
|
||||||
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@v5
|
uses: actions/upload-artifact@v4
|
||||||
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@v5
|
uses: actions/upload-artifact@v4
|
||||||
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@v5
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: build/hashes.txt
|
path: build/hashes.txt
|
||||||
name: hashes.txt
|
name: hashes.txt
|
||||||
|
|||||||
4
.github/workflows/codeql.yml
vendored
4
.github/workflows/codeql.yml
vendored
@@ -49,7 +49,7 @@ jobs:
|
|||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v4
|
uses: github/codeql-action/init@v3
|
||||||
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@v4
|
uses: github/codeql-action/analyze@v3
|
||||||
with:
|
with:
|
||||||
category: "/language:${{matrix.language}}"
|
category: "/language:${{matrix.language}}"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
Skip all downloads and only build launcher.
|
Skip all downloads and only build launcher.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\build -verbose
|
.\build.ps1 -verbose
|
||||||
|
|
||||||
Execute the build and see what's going on.
|
Execute the build and see what's going on.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
Samuel Vasko, Jack Bennett
|
Samuel Vasko, Jack Bennett
|
||||||
Part of the Cmder project.
|
Part of the Cmder project.
|
||||||
.LINK
|
.LINK
|
||||||
http://cmder.app/ - Project Home
|
https://github.com/cmderdev/cmder - Project Home
|
||||||
#>
|
#>
|
||||||
[CmdletBinding(SupportsShouldProcess = $true)]
|
[CmdletBinding(SupportsShouldProcess = $true)]
|
||||||
Param(
|
Param(
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ Param(
|
|||||||
[string]$saveTo = "$PSScriptRoot\..\build"
|
[string]$saveTo = "$PSScriptRoot\..\build"
|
||||||
)
|
)
|
||||||
|
|
||||||
$cmderRoot = Resolve-Path $cmderRoot
|
$cmder_root = Resolve-Path $cmderRoot
|
||||||
|
|
||||||
. "$PSScriptRoot\utils.ps1"
|
. "$PSScriptRoot\utils.ps1"
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
@@ -47,10 +47,10 @@ $targets = @{
|
|||||||
"cmder_mini.zip" = "-xr!`"vendor\git-for-windows`"";
|
"cmder_mini.zip" = "-xr!`"vendor\git-for-windows`"";
|
||||||
}
|
}
|
||||||
|
|
||||||
Push-Location -Path $cmderRoot
|
Push-Location -Path $cmder_root
|
||||||
|
|
||||||
Delete-Existing "$cmderRoot\Version*"
|
Delete-Existing "$cmder_root\Version*"
|
||||||
Delete-Existing "$cmderRoot\build\*"
|
Delete-Existing "$cmder_root\build\*"
|
||||||
|
|
||||||
if (-not (Test-Path -PathType container $saveTo)) {
|
if (-not (Test-Path -PathType container $saveTo)) {
|
||||||
(New-Item -ItemType Directory -Path $saveTo) | Out-Null
|
(New-Item -ItemType Directory -Path $saveTo) | Out-Null
|
||||||
@@ -59,16 +59,16 @@ if (-not (Test-Path -PathType container $saveTo)) {
|
|||||||
$saveTo = Resolve-Path $saveTo
|
$saveTo = Resolve-Path $saveTo
|
||||||
|
|
||||||
$version = Get-VersionStr
|
$version = Get-VersionStr
|
||||||
(New-Item -ItemType file "$cmderRoot\Version $version") | Out-Null
|
(New-Item -ItemType file "$cmder_root\Version $version") | Out-Null
|
||||||
|
|
||||||
if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) {
|
if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) {
|
||||||
Write-Verbose "Packing Cmder $version in $saveTo..."
|
Write-Verbose "Packing Cmder $version in $saveTo..."
|
||||||
$excluded = (Get-Content -Path "$cmderRoot\packignore") -Split [System.Environment]::NewLine | Where-Object { $_ }
|
$excluded = (Get-Content -Path "$cmder_root\packignore") -Split [System.Environment]::NewLine | Where-Object { $_ }
|
||||||
Get-ChildItem $cmderRoot -Force -Exclude $excluded
|
Get-ChildItem $cmder_root -Force -Exclude $excluded
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($t in $targets.GetEnumerator()) {
|
foreach ($t in $targets.GetEnumerator()) {
|
||||||
Create-Archive "$cmderRoot" "$saveTo\$($t.Name)" $t.Value
|
Create-Archive "$cmder_root" "$saveTo\$($t.Name)" $t.Value
|
||||||
$hash = (Digest-Hash "$saveTo\$($t.Name)")
|
$hash = (Digest-Hash "$saveTo\$($t.Name)")
|
||||||
Add-Content -path "$saveTo\hashes.txt" -value ($t.Name + ' ' + $hash)
|
Add-Content -path "$saveTo\hashes.txt" -value ($t.Name + ' ' + $hash)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,17 +5,17 @@
|
|||||||
This script updates dependencies to the latest version in vendor/sources.json file.
|
This script updates dependencies to the latest version in vendor/sources.json file.
|
||||||
|
|
||||||
You will need to make this script executable by setting your Powershell Execution Policy to Remote signed
|
You will need to make this script executable by setting your Powershell Execution Policy to Remote signed
|
||||||
Then unblock the script for execution with UnblockFile .\build.ps1
|
Then unblock the script for execution with UnblockFile .\update.ps1
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\build.ps1
|
.\update.ps1
|
||||||
|
|
||||||
Updates the dependency sources in the default location, the vendor/sources.json file.
|
Updates the dependency sources in the default location, the vendor/sources.json file.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\build -verbose
|
.\update.ps1 -verbose
|
||||||
|
|
||||||
Updates the dependency sources and see what's going on.
|
Updates the dependency sources and see what's going on.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\build.ps1 -SourcesPath '~/custom/vendors.json'
|
.\update.ps1 -SourcesPath '~/custom/vendors.json'
|
||||||
|
|
||||||
Specify the path to update dependency sources file at.
|
Specify the path to update dependency sources file at.
|
||||||
.NOTES
|
.NOTES
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
David Refoua <David@Refoua.me>
|
David Refoua <David@Refoua.me>
|
||||||
Part of the Cmder project.
|
Part of the Cmder project.
|
||||||
.LINK
|
.LINK
|
||||||
http://cmder.app/ - Project Home
|
https://github.com/cmderdev/cmder - Project Home
|
||||||
#>
|
#>
|
||||||
[CmdletBinding(SupportsShouldProcess = $true)]
|
[CmdletBinding(SupportsShouldProcess = $true)]
|
||||||
Param(
|
Param(
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
function Ensure-Exists($path) {
|
function Ensure-Exists($path) {
|
||||||
if (-not (Test-Path $path)) {
|
if (-not (Test-Path $path)) {
|
||||||
Write-Error "Missing required $path! Ensure it is installed"
|
throw "Missing required $path! Ensure it is installed"
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
return $true > $null
|
return $true > $null
|
||||||
}
|
}
|
||||||
@@ -16,8 +15,7 @@ function Ensure-Executable($command) {
|
|||||||
Set-Alias -Name "7z" -Value "$env:programw6432\7-zip\7z.exe" -Scope script
|
Set-Alias -Name "7z" -Value "$env:programw6432\7-zip\7z.exe" -Scope script
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Error "Missing $command! Ensure it is installed and on in the PATH"
|
throw "Missing $command! Ensure it is installed and on in the PATH"
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
vendor/lib/lib_base.cmd
vendored
2
vendor/lib/lib_base.cmd
vendored
@@ -4,7 +4,7 @@ set lib_base=call "%~dp0lib_base.cmd"
|
|||||||
|
|
||||||
if "%~1" == "/h" (
|
if "%~1" == "/h" (
|
||||||
%lib_base% help "%~0"
|
%lib_base% help "%~0"
|
||||||
) else if "%~1" neq "" (
|
) else if "%1" neq "" (
|
||||||
call :%*
|
call :%*
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
2
vendor/lib/lib_console.cmd
vendored
2
vendor/lib/lib_console.cmd
vendored
@@ -14,7 +14,7 @@ if %fast_init% gtr %verbose_output% if %fast_init% gtr %debug_output% exit /b
|
|||||||
|
|
||||||
if "%~1" == "/h" (
|
if "%~1" == "/h" (
|
||||||
%lib_base% help "%~0"
|
%lib_base% help "%~0"
|
||||||
) else if "%~1" neq "" (
|
) else if "%1" neq "" (
|
||||||
call :%*
|
call :%*
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
4
vendor/lib/lib_git.cmd
vendored
4
vendor/lib/lib_git.cmd
vendored
@@ -1,12 +1,12 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
call "%~dp0lib_base.cmd"
|
call "%~dp0lib_base.cmd"
|
||||||
call "%~dp0lib_console.cmd"
|
call "%%~dp0lib_console.cmd"
|
||||||
set lib_git=call "%~dp0lib_git.cmd"
|
set lib_git=call "%~dp0lib_git.cmd"
|
||||||
|
|
||||||
if "%~1" == "/h" (
|
if "%~1" == "/h" (
|
||||||
%lib_base% help "%~0"
|
%lib_base% help "%~0"
|
||||||
) else if "%~1" neq "" (
|
) else if "%1" neq "" (
|
||||||
call :%*
|
call :%*
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
63
vendor/lib/lib_path.cmd
vendored
63
vendor/lib/lib_path.cmd
vendored
@@ -1,12 +1,12 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
call "%~dp0lib_base.cmd"
|
call "%~dp0lib_base.cmd"
|
||||||
call "%~dp0lib_console.cmd"
|
call "%%~dp0lib_console"
|
||||||
set lib_path=call "%~dp0lib_path.cmd"
|
set lib_path=call "%~dp0lib_path.cmd"
|
||||||
|
|
||||||
if "%~1" == "/h" (
|
if "%~1" == "/h" (
|
||||||
%lib_base% help "%~0"
|
%lib_base% help "%~0"
|
||||||
) else if "%~1" neq "" (
|
) else if "%1" neq "" (
|
||||||
call :%*
|
call :%*
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ exit /b
|
|||||||
set "add_path=%~1"
|
set "add_path=%~1"
|
||||||
) else (
|
) else (
|
||||||
%print_error% "You must specify a directory to add to the path!"
|
%print_error% "You must specify a directory to add to the path!"
|
||||||
exit /b 1
|
exit 1
|
||||||
)
|
)
|
||||||
|
|
||||||
if "%~2" neq "" if /i "%~2" == "append" (
|
if "%~2" neq "" if /i "%~2" == "append" (
|
||||||
@@ -72,7 +72,7 @@ exit /b
|
|||||||
set "PATH=%add_to_path%;%PATH%"
|
set "PATH=%add_to_path%;%PATH%"
|
||||||
)
|
)
|
||||||
goto :end_enhance_path
|
goto :end_enhance_path
|
||||||
) else if "%add_to_path%" equ "" (
|
) else if "add_to_path" equ "" (
|
||||||
goto :end_enhance_path
|
goto :end_enhance_path
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -84,20 +84,20 @@ exit /b
|
|||||||
|
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
if "!found!" == "0" (
|
if "!found!" == "0" (
|
||||||
echo "!PATH!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!;"
|
echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!;"
|
||||||
call :set_found
|
call :set_found
|
||||||
)
|
)
|
||||||
%print_debug% :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!"
|
%print_debug% :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!"
|
||||||
|
|
||||||
if /i "!position!" == "append" (
|
if /i "!position!" == "append" (
|
||||||
if "!found!" == "0" (
|
if "!found!" == "0" (
|
||||||
echo "!PATH!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!$"
|
echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!\"$"
|
||||||
call :set_found
|
call :set_found
|
||||||
)
|
)
|
||||||
%print_debug% :enhance_path "Env Var END PATH !find_query! - found=!found!"
|
%print_debug% :enhance_path "Env Var END PATH !find_query! - found=!found!"
|
||||||
) else (
|
) else (
|
||||||
if "!found!" == "0" (
|
if "!found!" == "0" (
|
||||||
echo "!PATH!"|!WINDIR!\System32\findstr >nul /I /R /C:"^!find_query!;"
|
echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:"^\"!find_query!;"
|
||||||
call :set_found
|
call :set_found
|
||||||
)
|
)
|
||||||
%print_debug% :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!"
|
%print_debug% :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!"
|
||||||
@@ -119,8 +119,7 @@ exit /b
|
|||||||
:end_enhance_path
|
:end_enhance_path
|
||||||
set "PATH=%PATH:;;=;%"
|
set "PATH=%PATH:;;=;%"
|
||||||
|
|
||||||
REM echo %path%|wc -c
|
REM echo %path%|"C:\Users\dgames\cmder - dev\vendor\git-for-windows\usr\bin\wc" -c
|
||||||
|
|
||||||
if "%fast_init%" == "1" exit /b
|
if "%fast_init%" == "1" exit /b
|
||||||
|
|
||||||
if not "%OLD_PATH:~0,3000%" == "%OLD_PATH:~0,3001%" goto :toolong
|
if not "%OLD_PATH:~0,3000%" == "%OLD_PATH:~0,3001%" goto :toolong
|
||||||
@@ -128,22 +127,15 @@ exit /b
|
|||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:toolong
|
:toolong
|
||||||
set "_rand=%RANDOM%"
|
echo "%OLD_PATH%">"%temp%\cmder_lib_pathA"
|
||||||
if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" 2>nul 1>nul
|
echo "%PATH%">"%temp%\cmder_lib_pathB"
|
||||||
if exist "%temp%\%_rand%_cmder_lib_pathB" del "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul
|
fc /b "%temp%\cmder_lib_pathA" "%temp%\cmder_lib_pathB" 2>nul 1>nul
|
||||||
if exist "%temp%\%_rand%_cmder_lib_pathA" goto :toolong
|
if errorlevel 1 ( del "%temp%\cmder_lib_pathA" & del "%temp%\cmder_lib_pathB" & goto :changed )
|
||||||
if exist "%temp%\%_rand%_cmder_lib_pathB" goto :toolong
|
del "%temp%\cmder_lib_pathA" & del "%temp%\cmder_lib_pathB"
|
||||||
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%\%_rand%_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
|
||||||
%print_debug% :enhance_path "END Env Var - PATH=%PATH%"
|
%print_debug% :enhance_path "END Env Var - PATH=%path%"
|
||||||
%print_debug% :enhance_path "Env Var %find_query% - found=%found%"
|
%print_debug% :enhance_path "Env Var %find_query% - found=%found%"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@@ -187,31 +179,16 @@ exit /b
|
|||||||
set "add_path=%~1"
|
set "add_path=%~1"
|
||||||
) else (
|
) else (
|
||||||
%print_error% "You must specify a directory to add to the path!"
|
%print_error% "You must specify a directory to add to the path!"
|
||||||
exit /b 1
|
exit 1
|
||||||
)
|
)
|
||||||
|
|
||||||
rem Parse arguments robustly:
|
|
||||||
rem Accept either public form: "[dir_path]" [max_depth] [append]
|
|
||||||
rem or internal recursive form: "[dir_path]" [depth] [max_depth] [append]
|
|
||||||
set "depth=%~2"
|
set "depth=%~2"
|
||||||
set "max_depth=%~3"
|
set "max_depth=%~3"
|
||||||
set "position="
|
|
||||||
|
|
||||||
if /i "%~4" == "append" set "position=append"
|
if "%~4" neq "" if /i "%~4" == "append" (
|
||||||
if /i "%~3" == "append" (
|
set "position=%~4"
|
||||||
set "position=append"
|
) else (
|
||||||
set "max_depth="
|
set "position="
|
||||||
)
|
|
||||||
|
|
||||||
if not defined depth set "depth=0"
|
|
||||||
if not defined max_depth (
|
|
||||||
if defined depth (
|
|
||||||
rem If only one numeric argument provided, treat it as max_depth
|
|
||||||
set "max_depth=%depth%"
|
|
||||||
set "depth=0"
|
|
||||||
) else (
|
|
||||||
set "max_depth=1"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
dir "%add_path%" 2>NUL | findstr -i -e "%find_pathext%" >NUL
|
dir "%add_path%" 2>NUL | findstr -i -e "%find_pathext%" >NUL
|
||||||
@@ -247,6 +224,8 @@ exit /b
|
|||||||
call :loop_depth
|
call :loop_depth
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set "PATH=%PATH%"
|
||||||
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:set_depth
|
:set_depth
|
||||||
|
|||||||
4
vendor/lib/lib_profile.cmd
vendored
4
vendor/lib/lib_profile.cmd
vendored
@@ -1,12 +1,12 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
call "%~dp0lib_base.cmd"
|
call "%~dp0lib_base.cmd"
|
||||||
call "%~dp0lib_console.cmd"
|
call "%%~dp0lib_console"
|
||||||
set lib_profile=call "%~dp0lib_profile.cmd"
|
set lib_profile=call "%~dp0lib_profile.cmd"
|
||||||
|
|
||||||
if "%~1" == "/h" (
|
if "%~1" == "/h" (
|
||||||
%lib_base% help "%~0"
|
%lib_base% help "%~0"
|
||||||
) else if "%~1" neq "" (
|
) else if "%1" neq "" (
|
||||||
call :%*
|
call :%*
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user