mirror of
https://github.com/cmderdev/cmder.git
synced 2025-11-08 21:29:02 +08:00
Compare commits
2 Commits
update-ven
...
copilot/su
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7510436f7d | ||
|
|
f6eb7aa4f8 |
@@ -32,11 +32,7 @@ Param(
|
||||
# -whatif switch to not actually make changes
|
||||
|
||||
# Path to the vendor configuration source file
|
||||
[string]$sourcesPath = "$PSScriptRoot\..\vendor\sources.json",
|
||||
|
||||
# Include pre-release versions (RC, beta, alpha, etc.)
|
||||
# By default, only stable releases are considered
|
||||
[switch]$IncludePrerelease = $false
|
||||
[string]$sourcesPath = "$PSScriptRoot\..\vendor\sources.json"
|
||||
)
|
||||
|
||||
# Get the root directory of the cmder project.
|
||||
@@ -83,39 +79,11 @@ function Match-Filenames {
|
||||
return $position
|
||||
}
|
||||
|
||||
# Checks if a release is a pre-release based on GitHub API flag and version tag keywords
|
||||
# Pre-release keywords include: -rc (release candidate), -beta, -alpha, -preview, -pre
|
||||
function Test-IsPrerelease {
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
$release
|
||||
)
|
||||
|
||||
# Check if marked as pre-release by GitHub
|
||||
if ($release.prerelease -eq $true) {
|
||||
return $true
|
||||
}
|
||||
|
||||
# Check for common pre-release keywords in tag name
|
||||
# This catches versions like v2.50.0-rc, v1.0.0-beta, v1.0.0-alpha, etc.
|
||||
$prereleaseKeywords = @('-rc', '-beta', '-alpha', '-preview', '-pre')
|
||||
foreach ($keyword in $prereleaseKeywords) {
|
||||
if ($release.tag_name -ilike "*$keyword*") {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
|
||||
return $false
|
||||
}
|
||||
|
||||
# Uses the GitHub api in order to fetch the current download links for the latest releases of the repo.
|
||||
function Fetch-DownloadUrl {
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
$urlStr,
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[bool]$includePrerelease = $false
|
||||
$urlStr
|
||||
)
|
||||
|
||||
$url = [uri] $urlStr
|
||||
@@ -159,13 +127,6 @@ function Fetch-DownloadUrl {
|
||||
}
|
||||
|
||||
:loop foreach ($i in $info) {
|
||||
# Skip pre-release versions unless explicitly included
|
||||
# Pre-releases include RC (Release Candidate), beta, alpha, and other test versions
|
||||
if (-not $includePrerelease -and (Test-IsPrerelease $i)) {
|
||||
Write-Verbose "Skipping pre-release version: $($i.tag_name)"
|
||||
continue
|
||||
}
|
||||
|
||||
if (-not ($i.assets -is [array])) {
|
||||
continue
|
||||
}
|
||||
@@ -203,26 +164,12 @@ function Fetch-DownloadUrl {
|
||||
|
||||
# Special case for archive downloads of repository
|
||||
if (($null -eq $downloadLinks) -or (-not $downloadLinks)) {
|
||||
if ((($p | ForEach-Object { $_.Trim('/') }) -contains "archive")) {
|
||||
# Find the first release that matches our pre-release filtering criteria
|
||||
$selectedRelease = $null
|
||||
foreach ($release in $info) {
|
||||
# Apply the same filtering logic
|
||||
if (-not $includePrerelease -and (Test-IsPrerelease $release)) {
|
||||
continue
|
||||
}
|
||||
# Use the first release that passes the filter
|
||||
$selectedRelease = $release
|
||||
break
|
||||
}
|
||||
|
||||
if ($selectedRelease -and $selectedRelease.tag_name) {
|
||||
for ($i = 0; $i -lt $p.Length; $i++) {
|
||||
if ($p[$i].Trim('/') -eq "archive") {
|
||||
$p[$i + 1] = $selectedRelease.tag_name + ".zip"
|
||||
$downloadLinks = $url.Scheme + "://" + $url.Host + ($p -join '')
|
||||
return $downloadLinks
|
||||
}
|
||||
if ((($p | ForEach-Object { $_.Trim('/') }) -contains "archive") -and $info[0].tag_name) {
|
||||
for ($i = 0; $i -lt $p.Length; $i++) {
|
||||
if ($p[$i].Trim('/') -eq "archive") {
|
||||
$p[$i + 1] = $info[0].tag_name + ".zip"
|
||||
$downloadLinks = $url.Scheme + "://" + $url.Host + ($p -join '')
|
||||
return $downloadLinks
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -268,7 +215,7 @@ foreach ($s in $sources) {
|
||||
|
||||
Write-Verbose "Old Link: $($s.url)"
|
||||
|
||||
$downloadUrl = Fetch-DownloadUrl $s.url -includePrerelease $IncludePrerelease
|
||||
$downloadUrl = Fetch-DownloadUrl $s.url
|
||||
|
||||
if (($null -eq $downloadUrl) -or ($downloadUrl -eq '')) {
|
||||
Write-Verbose "No new links were found"
|
||||
|
||||
2
vendor/init.bat
vendored
2
vendor/init.bat
vendored
@@ -355,7 +355,7 @@ 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 (
|
||||
for /F "delims=" %%F in ('!git_locale! -uU 2') do (
|
||||
set "LANG=%%F"
|
||||
)
|
||||
)
|
||||
|
||||
29
vendor/lib/lib_path.cmd
vendored
29
vendor/lib/lib_path.cmd
vendored
@@ -91,13 +91,13 @@ exit /b
|
||||
|
||||
if /i "!position!" == "append" (
|
||||
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
|
||||
)
|
||||
%print_debug% :enhance_path "Env Var END PATH !find_query! - found=!found!"
|
||||
) else (
|
||||
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
|
||||
)
|
||||
%print_debug% :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!"
|
||||
@@ -190,13 +190,28 @@ exit /b
|
||||
exit /b 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 "max_depth=%~3"
|
||||
set "position="
|
||||
|
||||
if "%~4" neq "" if /i "%~4" == "append" (
|
||||
set "position=%~4"
|
||||
) else (
|
||||
set "position="
|
||||
if /i "%~4" == "append" set "position=append"
|
||||
if /i "%~3" == "append" (
|
||||
set "position=append"
|
||||
set "max_depth="
|
||||
)
|
||||
|
||||
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
|
||||
@@ -232,8 +247,6 @@ exit /b
|
||||
call :loop_depth
|
||||
)
|
||||
|
||||
set "PATH=%PATH%"
|
||||
|
||||
exit /b
|
||||
|
||||
:set_depth
|
||||
|
||||
19
vendor/sources.json
vendored
19
vendor/sources.json
vendored
@@ -1,27 +1,22 @@
|
||||
[
|
||||
{
|
||||
"name": "git-for-windows",
|
||||
"version": "2.51.2.windows.1",
|
||||
"url": "https://github.com/git-for-windows/git/releases/download/v2.51.2.windows.1/PortableGit-2.51.2-64-bit.7z.exe"
|
||||
"version": "2.49.0.windows.1",
|
||||
"url": "https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/PortableGit-2.49.0-64-bit.7z.exe"
|
||||
},
|
||||
{
|
||||
"name": "clink",
|
||||
"version": "1.8.8",
|
||||
"url": "https://github.com/chrisant996/clink/releases/download/v1.8.8/clink.1.8.8.a63364.zip"
|
||||
"version": "1.7.14",
|
||||
"url": "https://github.com/chrisant996/clink/releases/download/v1.7.14/clink.1.7.14.843933.zip"
|
||||
},
|
||||
{
|
||||
"name": "conemu-maximus5",
|
||||
"version": "23.07.24",
|
||||
"url": "https://github.com/ConEmu/ConEmu/releases/download/v23.07.24/ConEmuPack.230724.7z"
|
||||
},
|
||||
{
|
||||
"name": "windows-terminal",
|
||||
"version": "1.23.12811.0",
|
||||
"url": "https://github.com/microsoft/terminal/releases/download/v1.23.12811.0/Microsoft.WindowsTerminal_1.23.12811.0_x64.zip"
|
||||
"url": "https://github.com/Maximus5/ConEmu/releases/download/v23.07.24/ConEmuPack.230724.7z"
|
||||
},
|
||||
{
|
||||
"name": "clink-completions",
|
||||
"version": "0.6.6",
|
||||
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.6.6.zip"
|
||||
"version": "0.6.2",
|
||||
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.6.2.zip"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user