Merge branch 'master' into development

This commit is contained in:
DRSDavidSoft 2023-04-23 20:17:40 +00:00
commit 6180aa53b3
16 changed files with 273 additions and 96 deletions

View File

@ -25,8 +25,8 @@ body:
Cmder version:
Operating system:
value: |
Cmder version:
Operating system:
Cmder version:
Operating system:
render: markdown
validations:
required: true
@ -55,7 +55,7 @@ body:
| 🌐 [Open Link](https://github.com/cmderdev/cmder/blob/master/README.md) | 🌐 [Open Link](https://github.com/cmderdev/cmder/wiki) |
(What you may be asking here could already be explained there!)
- Searched for existing issues (including the **closed** ones) for similar problems here:
🗃 https://github.com/cmderdev/cmder/issues?q=is:issue
@ -91,7 +91,7 @@ body:
#### Prerequisites before submitting an issue
- We do not support any versions older than the current release series, if you are using an older Cmder please update to the latest version first.
- Verify that the issue is not fixed and is reproducible in the **[latest official Cmder version](https://github.com/cmderdev/cmder/releases).**
- Verify that the issue is not already fixed and is reproducible in the **[latest official Cmder version](https://github.com/cmderdev/cmder/releases).**
- Check the **[current issues list](https://github.com/cmderdev/cmder/issues?q=is%3Aissue)** and perform a **search of the issue tracker (including closed ones)** to avoid posting a duplicate bug report.
- Make sure this is not a support request or question, both of which are better suited for either the **[discussions section](https://github.com/cmderdev/cmder/discussions)**, or the **[questions section](https://github.com/cmderdev/cmder/issues/new?template=question.yml)**.
- Verify that the **[wiki](https://github.com/cmderdev/cmder/wiki)** did not contain a suitable solution either.

View File

@ -19,7 +19,7 @@ body:
- If you would like to ask for guides on how to integrate Cmder with your favorite IDE of choice, or how to perform a specific task with Cmder, make sure you visit our label section first.
You may already have an answer under the Guides or Questions section.
You may already have an answer under the [💬 Guides](https://github.com/cmderdev/cmder/issues?q=label%3A%22%F0%9F%92%AC+Type%3A+Guide%22), [📖 Documentation](https://github.com/cmderdev/cmder/issues?q=label%3A%22%F0%9F%93%96+Documentation%22) or [❔ Questions](https://github.com/cmderdev/cmder/issues?q=is%3Aissue+label%3A%22%E2%9D%94+Type%3A+Question%22) section.
For a list of labels, visit **[Labels](https://github.com/cmderdev/cmder/labels)**.

11
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

33
.github/workflows/branches.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Update branches
# Controls when the action will run.
on:
# Triggers the workflow on push events for the development branch
push:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This job updates the development branch with the master branch
update-development:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all history for all branches and tags
# Runs a single command using the runners shell
- name: Merge master into development
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git checkout development
git merge --no-ff master
git push origin development

View File

@ -8,6 +8,8 @@ name: Build Cmder
on:
push:
branches: [ "master" ]
tags:
- "v*"
pull_request:
branches: [ "master" ]
@ -72,3 +74,15 @@ jobs:
with:
path: build/hashes.txt
name: hashes.txt
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
build/cmder.zip
build/cmder.7z
build/cmder_mini.zip
build/hashes.txt
draft: true
generate_release_notes: true
if: startsWith(github.ref, 'refs/tags/')

68
.github/workflows/codeql.yml vendored Normal file
View File

@ -0,0 +1,68 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '30 19 * * 0'
jobs:
analyze:
name: Analyze
runs-on: windows-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Build Cmder Launcher
shell: pwsh
working-directory: scripts
run: .\build.ps1 -Compile -verbose
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"

View File

@ -30,6 +30,8 @@ jobs:
- id: make-changes
name: Checking for updates
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$currentVersion = (Get-Content .\vendor\sources.json | ConvertFrom-Json)
. .\scripts\update.ps1 -verbose
@ -49,7 +51,7 @@ jobs:
Set-GHVariable -Name LIST_UPDATED -Value $listUpdated.Trim(', ')
echo "UPDATE_MESSAGE<<<EOF`n$updateMessage`n<EOF" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- uses: peter-evans/create-pull-request@v4
- uses: peter-evans/create-pull-request@v5
if: env.COUNT_UPDATED > 0
with:
title: 'Updates to `${{ env.COUNT_UPDATED }}` vendored dependencies'

View File

@ -425,11 +425,6 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
swprintf_s(args, L"%s /single", args);
}
if (!streqi(cmderTask.c_str(), L""))
{
swprintf_s(args, L"%s /run {%s}", args, cmderTask.c_str());
}
if (!streqi(cmderTitle.c_str(), L""))
{
swprintf_s(args, L"%s /title \"%s\"", args, cmderTitle.c_str());
@ -445,6 +440,14 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
swprintf_s(args, L"%s %s", args, cmderConEmuArgs.c_str());
}
// The `/run` arg and its value MUST be the last arg of ConEmu
// see : https://conemu.github.io/en/ConEmuArgs.html
// > This must be the last used switch (excepting -new_console and -cur_console)
if (!streqi(cmderTask.c_str(), L""))
{
swprintf_s(args, L"%s /run {%s}", args, cmderTask.c_str());
}
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
if (wcscmp(userConfigDirPath, configDirPath) != 0)
{

View File

@ -102,6 +102,12 @@ function Fetch-DownloadUrl {
$p = $url.Segments.Split([Environment]::NewLine)
$headers = @{}
if ($env:GITHUB_TOKEN) {
$headers["Authorization"] = "token $($env:GITHUB_TOKEN)"
}
# Api server for GitHub
$urlHost = "api.github.com"
@ -110,7 +116,7 @@ function Fetch-DownloadUrl {
$apiUrl = [uri] (New-Object System.UriBuilder -ArgumentList $url.Scheme, $urlHost, -1, $urlPath).Uri
$info = Invoke-RestMethod -Uri $apiUrl
$info = Invoke-RestMethod -Uri $apiUrl -Headers $headers
$downloadLinks = (New-Object System.Collections.Generic.List[System.Object])

122
vendor/clink.lua vendored
View File

@ -408,13 +408,63 @@ local function get_svn_status()
return true
end
---
-- Get the status of working dir
-- @return {bool}
---
local last_git_status_time = nil
local last_git_status_setting = true
local function get_git_status_setting()
local time = os.clock()
local last_time = last_git_status_time
last_git_status_time = time
if last_time and time >= 0 and time - last_time < 10 then
return last_git_status_setting
end
-- When async prompt filtering is available, check the
-- prompt_overrideGitStatusOptIn config setting for whether to ignore the
-- cmder.status and cmder.cmdstatus git config opt-in settings.
if clink.promptcoroutine and io.popenyield and settings.get("prompt.async") then
if prompt_overrideGitStatusOptIn then
last_git_status_setting = true
return true
end
end
local gitStatusConfig = io_popenyield("git --no-pager config cmder.status 2>nul")
for line in gitStatusConfig:lines() do
if string.match(line, 'false') then
gitStatusConfig:close()
last_git_status_setting = false
return false
end
end
gitStatusConfig:close()
local gitCmdStatusConfig = io_popenyield("git --no-pager config cmder.cmdstatus 2>nul")
for line in gitCmdStatusConfig:lines() do
if string.match(line, 'false') then
gitCmdStatusConfig:close()
last_git_status_setting = false
return false
end
end
gitCmdStatusConfig:close()
last_git_status_setting = true
return true
end
---
-- Use a prompt coroutine to get git status in the background.
-- Cache the info so we can reuse it next time to reduce flicker.
---
local function get_git_info_table()
local info = clink_promptcoroutine(function ()
return get_git_status()
-- Use git status if allowed.
local cmderGitStatusOptIn = get_git_status_setting()
return cmderGitStatusOptIn and get_git_status() or {}
end)
if not info then
info = cached_info.git_info or {}
@ -424,42 +474,6 @@ local function get_git_info_table()
return info
end
---
-- Get the status of working dir
-- @return {bool}
---
local function get_git_status_setting()
-- When async prompt filtering is available, check the
-- prompt_overrideGitStatusOptIn config setting for whether to ignore the
-- cmder.status and cmder.cmdstatus git config opt-in settings.
if clink.promptcoroutine and io.popenyield and settings.get("prompt.async") then
if prompt_overrideGitStatusOptIn then
return true
end
end
local gitStatusConfig = io.popen("git --no-pager config cmder.status 2>nul")
for line in gitStatusConfig:lines() do
if string.match(line, 'false') then
gitStatusConfig:close()
return false
end
end
local gitCmdStatusConfig = io.popen("git --no-pager config cmder.cmdstatus 2>nul")
for line in gitCmdStatusConfig:lines() do
if string.match(line, 'false') then
gitCmdStatusConfig:close()
return false
end
end
gitStatusConfig:close()
gitCmdStatusConfig:close()
return true
end
local function git_prompt_filter()
-- Don't do any git processing if the prompt doesn't want to show git info.
@ -477,7 +491,6 @@ local function git_prompt_filter()
local git_dir = get_git_dir()
local color
cmderGitStatusOptIn = get_git_status_setting()
if git_dir then
local branch = get_git_branch(git_dir)
if branch then
@ -487,28 +500,25 @@ local function git_prompt_filter()
cached_info.git_dir = git_dir
cached_info.git_branch = branch
end
-- Use git status if allowed.
if cmderGitStatusOptIn then
-- if we're inside of git repo then try to detect current branch
-- Has branch => therefore it is a git folder, now figure out status
local gitInfo = get_git_info_table()
local gitStatus = gitInfo.status
local gitConflict = gitInfo.conflict
if gitStatus == nil then
color = colors.nostatus
elseif gitStatus then
color = colors.clean
else
color = colors.dirty
end
-- If we're inside of git repo then try to detect current branch
-- Has branch => therefore it is a git folder, now figure out status
local gitInfo = get_git_info_table()
local gitStatus = gitInfo.status
local gitConflict = gitInfo.conflict
if gitConflict then
color = colors.conflict
end
else
if gitStatus == nil then
color = colors.nostatus
elseif gitStatus then
color = colors.clean
else
color = colors.dirty
end
if gitConflict then
color = colors.conflict
end
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", " "..color.."("..verbatim(branch)..")")
return false
end

View File

@ -8,15 +8,15 @@ history.expand_mode = not_dquoted
# name: Skip adding lines prefixed with whitespace
# type: boolean
history.ignore_space = False
history.ignore_space = True
# name: The number of history lines to save
# type: integer
history.max_lines = 10000
history.max_lines = 25000
# name: Share history between instances
# type: boolean
history.shared = True
history.shared = False
# name: Auto-answer terminate prompt
# type: enum

6
vendor/cmder.sh vendored
View File

@ -33,11 +33,11 @@ CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::')
export CMDER_ROOT
if [ -d "/c/Program Files/Git" ] ; then
if [ -f "/c/Program Files/Git/cmd/git.exe" ] ; then
GIT_INSTALL_ROOT="/c/Program Files/Git"
elif [ -d "/c/Program Files(x86)/Git" ] ; then
elif [ -f "/c/Program Files(x86)/Git/cmd/git.exe" ] ; then
GIT_INSTALL_ROOT="/c/Program Files(x86)/Git"
elif [ -d "${CMDER_ROOT}/vendor/git-for-windows" ] ; then
elif [ -f "${CMDER_ROOT}/vendor/git-for-windows/cmd/git.exe" ] ; then
GIT_INSTALL_ROOT=${CMDER_ROOT}/vendor/git-for-windows
fi

39
vendor/init.bat vendored
View File

@ -148,7 +148,7 @@ if defined CMDER_USER_CONFIG (
)
if not "%CMDER_SHELL%" == "cmd" (
%print_warning% "Incompatible 'ComSpec/Shell' Detetected: %CMDER_SHELL%"
%print_warning% "Incompatible 'ComSpec/Shell' Detected: %CMDER_SHELL%"
set CMDER_CLINK=0
set CMDER_ALIASES=0
)
@ -161,16 +161,24 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" (
set clink_architecture=x64
set architecture_bits=64
) else (
%print_warning% "Incompatible Processor Detetected: %PROCESSOR_ARCHITECTURE%"
%print_warning% "Incompatible Processor Detected: %PROCESSOR_ARCHITECTURE%"
set CMDER_CLINK=0
)
if "%CMDER_CLINK%" == "1" (
REM TODO: If clink is already injected, goto :CLINK_FINISH
goto :INJECT_CLINK
)
goto :SKIP_CLINK
:INJECT_CLINK
%print_verbose% "Injecting Clink!"
:: Check if Clink is not present
if not exist "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" (
%print_error% "Clink executable is not present in 'vendor\clink\clink_%clink_architecture%.exe'"
goto :SKIP_CLINK
)
:: Run Clink
@ -185,7 +193,7 @@ if "%CMDER_CLINK%" == "1" (
copy "%CMDER_ROOT%\vendor\cmder_prompt_config.lua.default" "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua"
)
:: Cleanup lagacy Clink Settings file
:: Cleanup legacy Clink Settings file
if exist "%CMDER_CONFIG_DIR%\settings" if exist "%CMDER_CONFIG_DIR%\clink_settings" (
del "%CMDER_CONFIG_DIR%\settings"
)
@ -198,9 +206,12 @@ if "%CMDER_CLINK%" == "1" (
"%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor"
if errorlevel 1 (
%print_error% "Clink initilization has failed with error code: %errorlevel%"
%print_error% "Clink initialization has failed with error code: %errorlevel%"
)
) else (
goto :CLINK_FINISH
:SKIP_CLINK
%print_warning% "Skipping Clink Injection!"
for /f "tokens=2 delims=:." %%x in ('chcp') do set cp=%%x
@ -210,7 +221,8 @@ if "%CMDER_CLINK%" == "1" (
prompt $E[1;32;49m$P$S$_$E[1;30;49mλ$S$E[0m
chcp %cp%>nul
)
:CLINK_FINISH
if "%CMDER_CONFIGURED%" GTR "1" (
%print_verbose% "Cmder is already configured, skipping Cmder Init!"
@ -237,6 +249,13 @@ if defined GIT_INSTALL_ROOT (
%print_debug% init.bat "Skipping Git Auto-Detect!"
goto :VENDORED_GIT
)
%print_debug% init.bat "Fast init is enabled, vendored Git does not exist"
for /F "delims=" %%F in ('where git.exe 2^>nul') do (
set "EXT_GIT_EXE=%%~fF"
%print_debug% init.bat "Found User installed Git at '%%~fF'. Skipping Git Auto-Detect!"
goto :SET_ENV
)
)
%print_debug% init.bat "Looking for Git install root..."
@ -309,6 +328,8 @@ if %nix_tools% geq 1 (
)
)
:SET_ENV
:: Plink (PuTTY Link) is a command-line connection tool similar to ssh, setting its protocol to ssh
set PLINK_PROTOCOL=ssh
@ -316,6 +337,12 @@ set PLINK_PROTOCOL=ssh
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.
setlocal enabledelayedexpansion
if not defined git_locale if defined EXT_GIT_EXE (
set "GIT_INSTALL_ROOT=!EXT_GIT_EXE:\cmd\git.exe=!"
)
endlocal && set GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%
if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\locale.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\locale.exe"
if not defined git_locale for /F "tokens=* delims=" %%F in ('where locale.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" )
if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\env.exe" /usr/bin/locale

View File

@ -40,7 +40,7 @@ exit /b
:::.
:::-------------------------------------------------------------------------------
if %debug_output% gtr 0 echo DEBUG(%~1): %~2 & echo.
if %debug_output% gtr 0 echo %time% DEBUG(%~1): %~2 & echo.
exit /b
:verbose_output

17
vendor/profile.ps1 vendored
View File

@ -5,7 +5,7 @@
# !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
# !!! Use "%CMDER_ROOT%\config\user_profile.ps1" to add your own startup commands
$CMDER_INIT_START = $(Get-Date -UFormat %s)
$CMDER_INIT_START = Get-Date
# Compatibility with PS major versions <= 2
if (!$PSScriptRoot) {
@ -123,11 +123,11 @@ if (-not (Test-Path -PathType container "$ENV:CMDER_ROOT\config\profile.d")) {
Push-Location $ENV:CMDER_ROOT\config\profile.d
foreach ($x in Get-ChildItem *.psm1) {
Write-Verbose Write-Host Sourcing $x
Write-Verbose "Sourcing $x"
Import-Module $x
}
foreach ($x in Get-ChildItem *.ps1) {
Write-Verbose Write-Host Sourcing $x
Write-Verbose "Sourcing $x"
. $x
}
Pop-Location
@ -137,11 +137,11 @@ Pop-Location
if ($ENV:CMDER_USER_CONFIG -ne "" -and (Test-Path "$ENV:CMDER_USER_CONFIG\profile.d")) {
Push-Location $ENV:CMDER_USER_CONFIG\profile.d
foreach ($x in Get-ChildItem *.psm1) {
Write-Verbose Write-Host Sourcing $x
Write-Verbose "Sourcing $x"
Import-Module $x
}
foreach ($x in Get-ChildItem *.ps1) {
Write-Verbose Write-Host Sourcing $x
Write-Verbose "Sourcing $x"
. $x
}
Pop-Location
@ -224,5 +224,8 @@ if ( $(Get-Command prompt).Definition -match 'PS \$\(\$executionContext.SessionS
Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly
}
$CMDER_INIT_END = $(Get-Date -UFormat %s)
Write-Verbose "Elapsed Time: $(get-Date) `($($CMDER_INIT_END - $CMDER_INIT_START) total`)"
$CMDER_INIT_END = Get-Date
$ElapsedTime = New-TimeSpan -Start $CMDER_INIT_START -End $CMDER_INIT_END
Write-Verbose "Elapsed Time: $($ElapsedTime.TotalSeconds) seconds total"

16
vendor/sources.json vendored
View File

@ -1,22 +1,22 @@
[
{
"name": "git-for-windows",
"version": "2.38.1.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.38.1.windows.1/PortableGit-2.38.1-64-bit.7z.exe"
"version": "2.40.0.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.40.0.windows.1/PortableGit-2.40.0-64-bit.7z.exe"
},
{
"name": "clink",
"version": "1.3.51",
"url": "https://github.com/chrisant996/clink/releases/download/v1.3.51/clink.1.3.51.28dd7d.zip"
"version": "1.4.23",
"url": "https://github.com/chrisant996/clink/releases/download/v1.4.23/clink.1.4.23.5fc3fc.zip"
},
{
"name": "conemu-maximus5",
"version": "22.08.07",
"url": "https://github.com/Maximus5/ConEmu/releases/download/v22.08.07/ConEmuPack.220807.7z"
"version": "22.12.18",
"url": "https://github.com/Maximus5/ConEmu/releases/download/v22.12.18/ConEmuPack.221218.7z"
},
{
"name": "clink-completions",
"version": "0.4.1",
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.4.1.zip"
"version": "0.4.7",
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.4.7.zip"
}
]