Compare commits

..

7 Commits

Author SHA1 Message Date
bc0db6a7b6 cleanup 2023-03-16 20:40:29 -04:00
eb2444d04a more vagrant stuff 2023-03-16 14:32:46 -07:00
f318bcc1b5 cleanup 2023-03-15 08:49:58 -04:00
c56559873c fixes 2023-03-15 08:46:55 -04:00
e33713a93f more vagrant stuff 2023-03-15 08:45:01 -04:00
324aaf74f2 more vagrant stuff 2023-03-15 08:17:18 -04:00
d73f9592d8 start to add vagrant bits 2023-03-15 04:39:02 -07:00
28 changed files with 2890 additions and 234 deletions

View File

@ -1,33 +0,0 @@
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@v4
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

@ -11,7 +11,7 @@ on:
tags:
- "v*"
pull_request:
branches: [ "master", "development" ]
branches: [ "master" ]
#---------------------------------#
# environment configuration #
@ -30,17 +30,15 @@ jobs:
build:
name: Build Project
runs-on: windows-latest
permissions:
contents: write
discussions: write
steps:
- name: Check out repository code (Action from GitHub)
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
uses: microsoft/setup-msbuild@v1
- name: Build Cmder Launcher
shell: pwsh
@ -53,32 +51,32 @@ jobs:
run: .\pack.ps1 -verbose
- name: Upload artifact (cmder.zip)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
path: build/cmder.zip
name: cmder.zip
if-no-files-found: error
- name: Upload artifact (cmder.7z)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
path: build/cmder.7z
name: cmder.7z
- name: Upload artifact (cmder_mini.zip)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
path: build/cmder_mini.zip
name: cmder_mini.zip
- name: Upload artifact (hashes.txt)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
path: build/hashes.txt
name: hashes.txt
- name: Create Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v1
with:
files: |
build/cmder.zip

View File

@ -3,25 +3,20 @@
#
# 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", "development" ]
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '.github/**'
- '**/.gitignore'
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master", "development" ]
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '.github/**'
- '**/.gitignore'
branches: [ "master" ]
schedule:
- cron: '30 19 * * 0'
@ -45,11 +40,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
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.
@ -60,7 +55,7 @@ jobs:
# queries: security-extended,security-and-quality
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
uses: microsoft/setup-msbuild@v1
- name: Build Cmder Launcher
shell: pwsh
@ -68,6 +63,6 @@ jobs:
run: .\build.ps1 -Compile -verbose
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"

View File

@ -4,21 +4,9 @@ on:
push:
branches:
- master
- development
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '.github/**'
- '**/.gitignore'
pull_request:
branches:
- master
- development
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '.github/**'
- '**/.gitignore'
defaults:
run:
@ -38,7 +26,7 @@ jobs:
continue-on-error: false
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Initialize vendors
shell: pwsh
working-directory: scripts

View File

@ -24,7 +24,7 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
fetch-depth: 0
@ -51,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@v6
- uses: peter-evans/create-pull-request@v4
if: env.COUNT_UPDATED > 0
with:
title: 'Updates to `${{ env.COUNT_UPDATED }}` vendored dependencies'

1
.gitignore vendored
View File

@ -31,3 +31,4 @@ launcher/src/version.rc2
.vs/*
.vscode
.idea
.vagrant/

View File

@ -1,24 +0,0 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| 1.3.x | :white_check_mark: |
| < 1.3 | |
## Reporting a Vulnerability
If you discover a security issue in our project, please report it to [MartiUK](https://github.com/MartiUK). We will acknowledge your email within 24 hours and provide a more detailed response within 48 hours. We will try to fix the issue as soon as possible and inform you when a new version is released.
Please include as much of the information listed below as you can to help us better understand and resolve the issue:
- The nature of the issue
- The affected source file(s) with full paths
- The location of the vulnerable code (tag/branch/commit or direct URL)
- Any special configuration needed to reproduce the issue
- Detailed steps to reproduce the issue
- Proof-of-concept or exploit code (if possible)
- The impact of the issue, including how an attacker could exploit it
Please do not disclose the vulnerability publicly until we have resolved it.

64
Vagrantfile vendored Normal file
View File

@ -0,0 +1,64 @@
Vagrant.configure("2") do |config|
required_plugins = %w( vagrant-vbguest )
required_plugins.each do |plugin|
system "vagrant plugin install #{plugin}" unless Vagrant.has_plugin? plugin
end
# config.vbguest.iso_path = "../../../../usr/share/virtualbox/VBoxGuestAdditions.iso"
config.vbguest.allow_downgrade = true
config.vm.define "cmderdev-10" do |win10|
win10.vm.hostname = "cmderdev-10"
win10.vm.box = "cmderdev-10"
# win10.vm.network :private_network, ip: "192.168.56.101"
win10.vm.provider :virtualbox do |v|
# v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--name", "cmderdev-10"]
v.customize ["modifyvm", :id, "--ostype", "Windows10_64"]
v.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
v.customize ["modifyvm", :id, "--memory", 8192]
v.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
#v.customize ["setextradata", :id, "GUI/ScaleFactor", "1.75"]
end
end
config.vm.define "cmderdev-11" do |win11|
win11.vm.hostname = "cmderdev-11"
win11.vm.box = "cmderdev-11"
# win11.vm.network :private_network, ip: "192.168.56.111"
win11.vm.provider :virtualbox do |v|
# v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--name", "cmderdev-11"]
v.customize ["modifyvm", :id, "--ostype", "Windows11_64"]
v.customize ["modifyvm", :id, "--graphicscontroller", "vboxvga"]
v.customize ["modifyvm", :id, "--memory", 8192]
v.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
#v.customize ["setextradata", :id, "GUI/ScaleFactor", "1.75"]
end
end
config.vm.define "cmderdev-10-pro-scaled" do |cmderdev|
cmderdev.vm.hostname = 'cmderdev-10-pro'
cmderdev.vm.box = "cmderdev-10"
cmderdev.vm.provider :virtualbox do |v|
# v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--name", "cmderdev-pro"]
v.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
v.customize ["modifyvm", :id, "--memory", 8192]
v.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
v.customize ["setextradata", :id, "GUI/ScaleFactor", "1.75"]
end
end
config.vm.provision "file", source: "./scripts/vagrant/windows_terminal_settings.json.default", destination: "windows_terminal_settings.json.default"
config.vm.provision "file", source: "./scripts/vagrant/windows_terminal_state.json.default", destination: "windows_terminal_state.json.default"
config.vm.provision "shell", path: './scripts/vagrant/add-cmder.ps1'
config.vm.provision "shell", path: './vendor/bin/add-vscodeprofile.ps1'
config.vm.provision "shell", path: './vendor/bin/add-windowsterminalprofiles.ps1'
config.vm.provision "shell", path: './vendor/bin/add-cmdertodesktop.ps1'
end

60
appveyor.yml Normal file
View File

@ -0,0 +1,60 @@
#---------------------------------#
# general configuration #
#---------------------------------#
version: 1.0.{build}-{branch}
# branches to build
branches:
# blacklist
except:
- gh-pages
#---------------------------------#
# environment configuration #
#---------------------------------#
# Operating system (build VM template)
os: Visual Studio 2022
#---------------------------------#
# build configuration #
#---------------------------------#
build_script:
- ps: cd scripts; .\build.ps1 -Compile -verbose
after_build:
- ps: .\pack.ps1 -verbose
# Disable test search, since we don't have any.
test: off
#---------------------------------#
# artifacts #
#---------------------------------#
artifacts:
- path: build\cmder.zip
name: cmderzip
- path: build\cmder.7z
name: cmder7z
- path: build\cmder_mini.zip
name: cmdermini
- path: build\hashes.txt
name: hashes
#---------------------------------#
# notifications #
#---------------------------------#
notifications:
# Webhook
- provider: Webhook
url: https://webhooks.gitter.im/e/d673abb1b2e659dcd625
on_build_success: true
on_build_failure: true
on_build_status_changed: true

View File

@ -469,6 +469,9 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
MessageBox(NULL, _T("Unable to create the ConEmu process!"), _T("Error"), MB_OK);
return;
}
LRESULT lr = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Environment", SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG, 5000, NULL);
lr = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)L"Environment", SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG, 5000, NULL); // For Windows >= 8
}
bool IsUserOnly(std::wstring opt)

View File

@ -1,7 +1,7 @@
/**
* WARNING: do NOT modify this file! the content of this file should be
* automatically generated before AppVeyor builds using the
* automatically genereted before AppVeyor builds using the
* respective .ps1 Powershell scripts.
*
*/

View File

@ -79,7 +79,7 @@ if ($Compile) {
Write-Verbose "Building the launcher..."
# Reference: https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
# Referene: https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
msbuild CmderLauncher.vcxproj /t:Clean,Build /p:configuration=Release /m
if ($LastExitCode -ne 0) {

View File

@ -0,0 +1,40 @@
choco install -y --force 7zip 7zip.install
choco install -y --force cmder
$env:path = "$env:path;c:/tools/cmder/vendor/git-for-windows/cmd"
c:
cd $env:userprofile
git clone https://github.com/cmderdev/cmder cmderdev
write-host "USERNAME: $env:USERNAME"
if ("$env:USERNAME" -eq "vagrant" -and -not (test-path "$env:userprofile/cmderdev/vendor/git-for-windows")) {
invoke-expression -command "TAKEOWN /F `"$env:userprofile/cmderdev`" /R /D y /s localhost /u vagrant /p vagrant"
}
cd cmderdev
git checkout vagrant
git pull origin vagrant
git remote add upstream https://github.com/cmderdev/cmder
git pull upstream master
# cmd.exe "/K" '"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat" && powershell -command "& ''$env:userprofile/cmderdev/scripts/build.ps1'' -verbose -compile" && exit'
# copy $env:userprofile/cmderdev/launcher/x64/release/cmder.exe $env:userprofile/cmderdev
# cmd.exe "/K" '"C:/Program Files (x86)/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat" && powershell -noexit -command "& ''build.ps1 -verbose -compile''"'
cd scripts
./build.ps1 -verbose
copy C:/Tools/Cmder/Cmder.exe $env:userprofile/cmderdev
# tabby
setx cmder_root "${env:userprofile}\cmderdev"
# C:\Users\vagrant\AppData\Roaming\Hyper
# // shell: '',
# shell: 'cmd.exe',
# // for setting shell arguments (i.e. for using interactive shellArgs: `['-i']`)
# // by default `['--login']` will be used
# // shellArgs: ['--login'],
# shellArgs: ['/k', 'C:\\users\\vagrant\\cmderdev\\vendor\\init.bat'],

View File

@ -0,0 +1,283 @@
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command":
{
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"
},
{
"command": "paste",
"keys": "ctrl+v"
},
{
"command": "find",
"keys": "ctrl+shift+f"
},
{
"command":
{
"action": "splitPane",
"split": "auto",
"splitMode": "duplicate"
},
"keys": "alt+shift+d"
}
],
"copyFormatting": "none",
"copyOnSelect": false,
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles":
{
"defaults": {},
"list":
[
{
"commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"hidden": false,
"name": "Windows PowerShell"
},
{
"commandline": "%SystemRoot%\\System32\\cmd.exe",
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"hidden": false,
"name": "Command Prompt"
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"guid": "{3b26d644-1d3b-5a0c-ab09-39d4dd9ae00e}",
"hidden": false,
"name": "Developer Command Prompt for VS 2022",
"source": "Windows.Terminal.VisualStudio"
},
{
"guid": "{589cd367-e65f-5e6a-a1c7-2b8d6f250da8}",
"hidden": false,
"name": "Developer PowerShell for VS 2022",
"source": "Windows.Terminal.VisualStudio"
}
]
},
"schemes":
[
{
"background": "#0C0C0C",
"black": "#0C0C0C",
"blue": "#0037DA",
"brightBlack": "#767676",
"brightBlue": "#3B78FF",
"brightCyan": "#61D6D6",
"brightGreen": "#16C60C",
"brightPurple": "#B4009E",
"brightRed": "#E74856",
"brightWhite": "#F2F2F2",
"brightYellow": "#F9F1A5",
"cursorColor": "#FFFFFF",
"cyan": "#3A96DD",
"foreground": "#CCCCCC",
"green": "#13A10E",
"name": "Campbell",
"purple": "#881798",
"red": "#C50F1F",
"selectionBackground": "#FFFFFF",
"white": "#CCCCCC",
"yellow": "#C19C00"
},
{
"background": "#012456",
"black": "#0C0C0C",
"blue": "#0037DA",
"brightBlack": "#767676",
"brightBlue": "#3B78FF",
"brightCyan": "#61D6D6",
"brightGreen": "#16C60C",
"brightPurple": "#B4009E",
"brightRed": "#E74856",
"brightWhite": "#F2F2F2",
"brightYellow": "#F9F1A5",
"cursorColor": "#FFFFFF",
"cyan": "#3A96DD",
"foreground": "#CCCCCC",
"green": "#13A10E",
"name": "Campbell Powershell",
"purple": "#881798",
"red": "#C50F1F",
"selectionBackground": "#FFFFFF",
"white": "#CCCCCC",
"yellow": "#C19C00"
},
{
"background": "#282C34",
"black": "#282C34",
"blue": "#61AFEF",
"brightBlack": "#5A6374",
"brightBlue": "#61AFEF",
"brightCyan": "#56B6C2",
"brightGreen": "#98C379",
"brightPurple": "#C678DD",
"brightRed": "#E06C75",
"brightWhite": "#DCDFE4",
"brightYellow": "#E5C07B",
"cursorColor": "#FFFFFF",
"cyan": "#56B6C2",
"foreground": "#DCDFE4",
"green": "#98C379",
"name": "One Half Dark",
"purple": "#C678DD",
"red": "#E06C75",
"selectionBackground": "#FFFFFF",
"white": "#DCDFE4",
"yellow": "#E5C07B"
},
{
"background": "#FAFAFA",
"black": "#383A42",
"blue": "#0184BC",
"brightBlack": "#4F525D",
"brightBlue": "#61AFEF",
"brightCyan": "#56B5C1",
"brightGreen": "#98C379",
"brightPurple": "#C577DD",
"brightRed": "#DF6C75",
"brightWhite": "#FFFFFF",
"brightYellow": "#E4C07A",
"cursorColor": "#4F525D",
"cyan": "#0997B3",
"foreground": "#383A42",
"green": "#50A14F",
"name": "One Half Light",
"purple": "#A626A4",
"red": "#E45649",
"selectionBackground": "#FFFFFF",
"white": "#FAFAFA",
"yellow": "#C18301"
},
{
"background": "#002B36",
"black": "#002B36",
"blue": "#268BD2",
"brightBlack": "#073642",
"brightBlue": "#839496",
"brightCyan": "#93A1A1",
"brightGreen": "#586E75",
"brightPurple": "#6C71C4",
"brightRed": "#CB4B16",
"brightWhite": "#FDF6E3",
"brightYellow": "#657B83",
"cursorColor": "#FFFFFF",
"cyan": "#2AA198",
"foreground": "#839496",
"green": "#859900",
"name": "Solarized Dark",
"purple": "#D33682",
"red": "#DC322F",
"selectionBackground": "#FFFFFF",
"white": "#EEE8D5",
"yellow": "#B58900"
},
{
"background": "#FDF6E3",
"black": "#002B36",
"blue": "#268BD2",
"brightBlack": "#073642",
"brightBlue": "#839496",
"brightCyan": "#93A1A1",
"brightGreen": "#586E75",
"brightPurple": "#6C71C4",
"brightRed": "#CB4B16",
"brightWhite": "#FDF6E3",
"brightYellow": "#657B83",
"cursorColor": "#002B36",
"cyan": "#2AA198",
"foreground": "#657B83",
"green": "#859900",
"name": "Solarized Light",
"purple": "#D33682",
"red": "#DC322F",
"selectionBackground": "#FFFFFF",
"white": "#EEE8D5",
"yellow": "#B58900"
},
{
"background": "#000000",
"black": "#000000",
"blue": "#3465A4",
"brightBlack": "#555753",
"brightBlue": "#729FCF",
"brightCyan": "#34E2E2",
"brightGreen": "#8AE234",
"brightPurple": "#AD7FA8",
"brightRed": "#EF2929",
"brightWhite": "#EEEEEC",
"brightYellow": "#FCE94F",
"cursorColor": "#FFFFFF",
"cyan": "#06989A",
"foreground": "#D3D7CF",
"green": "#4E9A06",
"name": "Tango Dark",
"purple": "#75507B",
"red": "#CC0000",
"selectionBackground": "#FFFFFF",
"white": "#D3D7CF",
"yellow": "#C4A000"
},
{
"background": "#FFFFFF",
"black": "#000000",
"blue": "#3465A4",
"brightBlack": "#555753",
"brightBlue": "#729FCF",
"brightCyan": "#34E2E2",
"brightGreen": "#8AE234",
"brightPurple": "#AD7FA8",
"brightRed": "#EF2929",
"brightWhite": "#EEEEEC",
"brightYellow": "#FCE94F",
"cursorColor": "#000000",
"cyan": "#06989A",
"foreground": "#555753",
"green": "#4E9A06",
"name": "Tango Light",
"purple": "#75507B",
"red": "#CC0000",
"selectionBackground": "#FFFFFF",
"white": "#D3D7CF",
"yellow": "#C4A000"
},
{
"background": "#000000",
"black": "#000000",
"blue": "#000080",
"brightBlack": "#808080",
"brightBlue": "#0000FF",
"brightCyan": "#00FFFF",
"brightGreen": "#00FF00",
"brightPurple": "#FF00FF",
"brightRed": "#FF0000",
"brightWhite": "#FFFFFF",
"brightYellow": "#FFFF00",
"cursorColor": "#FFFFFF",
"cyan": "#008080",
"foreground": "#C0C0C0",
"green": "#008000",
"name": "Vintage",
"purple": "#800080",
"red": "#800000",
"selectionBackground": "#FFFFFF",
"white": "#C0C0C0",
"yellow": "#808000"
}
],
"themes": []
}

View File

@ -0,0 +1,9 @@
{
"generatedProfiles" :
[
"{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"{589cd367-e65f-5e6a-a1c7-2b8d6f250da8}",
"{3b26d644-1d3b-5a0c-ab09-39d4dd9ae00e}"
],
"settingsHash" : "6e0f2330b78337f3-01d95614596b3f65"
}

1
vendor/bin/add-cmderrootenvar.ps1 vendored Normal file
View File

@ -0,0 +1 @@
setx cmder_root "${env:cmder_root}"

30
vendor/bin/add-cmdertodesktop.ps1 vendored Normal file
View File

@ -0,0 +1,30 @@
if (test-path "${env:USERPROFILE}\cmderdev") {
$env:cmder_root = "${env:USERPROFILE}\cmderdev"
write-host "Creating '${env:USERPROFILE}\Desktop\Cmderdev.lnk'..."
$setShortcut = "$env:cmder_root\vendor\bin\set-shortcut.ps1"
start-process -NoNewWindow -filePath "powershell.exe" -ArgumentList "-file `"${setShortcut}`" -sourceexe `"${env:cmder_root}\Cmder.exe`" -DestinationPath `"${env:USERPROFILE}\Desktop\Cmderdev.lnk`" -WorkingDirectory `"${env:cmder_root}`""
}
if (test-path "${env:USERPROFILE}\cmder") {
$env:cmder_root = "${env:USERPROFILE}\cmder"
if (test-path "${cmder_root}\vendor\bin\set-shortcut.ps1") {
$setShortcut = "$env:cmder_root\vendor\bin\set-shortcut.ps1"
}
write-host "Creating '${env:USERPROFILE}\Desktop\Cmder.lnk'..."
start-process -NoNewWindow -filePath "powershell.exe" -ArgumentList "-file `"${setShortcut}`" -sourceexe `"$env:cmder_root\Cmder.exe`" -DestinationPath `"${env:USERPROFILE}\Desktop\Cmder.lnk`" -WorkingDirectory `"${env:USERPROFILE}`""
} elseif (test-path "C:\tools\cmder") {
$env:cmder_root = "C:\tools\cmder"
if (test-path "${cmder_root}\vendor\bin\set-shortcut.ps1") {
$setShortcut = "$env:cmder_root\vendor\bin\set-shortcut.ps1"
}
write-host "Creating '${env:USERPROFILE}\Desktop\Cmder.lnk'..."
start-process -NoNewWindow -filePath "powershell.exe" -ArgumentList "-file `"${setShortcut}`" -sourceexe `"$env:cmder_root\Cmder.exe`" -DestinationPath `"${env:USERPROFILE}\Desktop\Cmder.lnk`" -WorkingDirectory `"${env:USERPROFILE}`""
}

39
vendor/bin/add-vscodeprofile.ps1 vendored Normal file
View File

@ -0,0 +1,39 @@
# VSCode
$VSCodeUserSettings = "$env:APPDATA/Code/User"
$VSCodeSettings = "$VSCodeUserSettings/settings.json";
$VSCodeSettingsNew = $VSCodeSettings.replace('.json', '-new.json')
if (test-path $VSCodeSettings) {
$data = get-content -path $VSCodeSettings -ErrorAction silentlycontinue | out-string | ConvertFrom-Json
}
else {
New-Item -ItemType directory $VSCodeUserSettings -force
$data = @{}
}
write-host $data
$data | Add-Member -force -Name 'terminal.integrated.defaultProfile.windows' -MemberType NoteProperty -Value "Cmder"
if ($null -eq $data.'terminal.integrated.profiles.windows') {
write-host "Adding 'terminal.integrated.profiles.windows'..."
$data | Add-Member -force -Name 'terminal.integrated.profiles.windows' -MemberType NoteProperty -Value @{}
}
write-host "Adding 'terminal.integrated.profiles.windows.Cmder' profile..."
$data.'terminal.integrated.profiles.windows'.'Cmder' = @{
"name" = "Cmder";
"path" = @(
"`${env:windir}/Sysnative/cmd.exe";
"`${env:windir}/System32/cmd.exe";
);
"args" = @(
"/k";
"`${env:USERPROFILE}/cmderdev/vendor/bin/vscode_init.cmd");
"icon" = "terminal-cmd";
"color" = "terminal.ansiGreen";
};
$data | ConvertTo-Json -depth 100 | set-content $VSCodeSettings

View File

@ -0,0 +1,74 @@
# Windows Terminal
$windowsTerminalFolder = (dir "$env:userprofile/AppData/Local/Packages/Microsoft.WindowsTerminal_*").name
$windowsTerminalPath = "$env:userprofile/AppData/Local/Packages/$windowsTerminalFolder"
$windowsTerminalSettings = $windowsTerminalPath + '/localState/settings.json'
$windowsTerminalSettingsNew = $windowsTerminalPath + '/localState/settings-new.json'
if (test-path "$env:userprofile/Documents/windows_terminal_settings.json.default") {
if (test-path "$windowsTerminalPath/LocalState/settings.json") {
del "$env:userprofile/Documents/windows_terminal_settings.json.default"
} else {
move-item -path $env:userprofile/Documents/windows_terminal_settings.json.default -destination $windowsTerminalPath/LocalState/settings.json
}
}
if (test-path "$env:userprofile/Documents/windows_terminal_state.json.default") {
if (test-path "$windowsTerminalPath/LocalState/state.json") {
del "$env:userprofile/Documents/windows_terminal_state.json.default"
} else {
move-item -path $env:userprofile/Documents/windows_terminal_state.json.default -destination $windowsTerminalPath/LocalState/state.json
}
}
if (test-path "$windowsTerminalPath/LocalState/state.json") {
$json = get-content $windowsTerminalSettings | ConvertFrom-Json
$json.defaultProfile="{00000000-0000-0000-ba54-000000000132}"
$cmderFound = $false
$cmderAsAdminFound = $false
foreach ($profile in $json.profiles.list) {
if ($profile.Name -eq "Cmder") {
$cmderFound = $true
}
elseIf ($profile.Name -eq "Cmder as Admin") {
$cmderAsAdminFound = $true
}
}
if (-not $cmderFound) {
write-host "Adding 'Cmder' to Windows Terminal..."
$json.profiles.list += @{
commandline="cmd.exe /k `"%USERPROFILE%/cmderdev/vendor/init.bat`"";
startingDirectory="%USERPROFILE%/cmderdev";
icon="%USERPROFILE%/cmderdev/icons/cmder.ico";
closeOnExit="graceful";
guid="{00000000-0000-0000-ba54-000000000132}";
hidden=$false;
name="Cmder"
}
}
if (-not $cmderAsAdminFound) {
write-host "Adding 'Cmder as Admin' to Windows Terminal..."
$json.profiles.list += @{
commandline="cmd.exe /k `"%USERPROFILE%/cmderdev/vendor/init.bat`"";
startingDirectory="%USERPROFILE%/cmderdev";
icon="%USERPROFILE%/cmderdev/icons/cmder_red.ico";
closeOnExit="graceful";
guid="{00000000-0000-0000-ba54-000000000133}";
hidden=$false;
elevate=$true;
name="Cmder as Admin"
}
}
$json | ConvertTo-Json -depth 100 | set-content $windowsTerminalSettings
}
else {
write-host "Cannot add profiles for Windows Terminal. The Windows Terminal settings file does not exist!"
}

View File

@ -9,5 +9,5 @@ if "%cmder_init%" == "1" (
)
pushd "%CMDER_ROOT%"
call "%CMDER_ROOT%\vendor\init.bat" /f %*
call "%CMDER_ROOT%\vendor\init.bat" /f
popd

21
vendor/bin/set-shortcut.ps1 vendored Normal file
View File

@ -0,0 +1,21 @@
[CmdletBinding()]
param(
[Parameter()]
[string]$SourceExe,
[string]$Arguments,
[string]$DestinationPath,
[string]$WorkingDirectory,
[String]$IconLocation
)
if ($IconLocation -eq '') {
$IconLocation = $SourceExe
}
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($destinationPath)
$Shortcut.TargetPath = $SourceExe
$Shortcut.Arguments = $Arguments
$shortcut.WorkingDirectory = $WorkingDirectory
$shortcut.IconLocation = $IconLocation
$Shortcut.Save()

153
vendor/clink.lua vendored
View File

@ -3,12 +3,7 @@
-- !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
-- !!! Use "%CMDER_ROOT%\config\<whatever>.lua" to add your lua startup scripts
-- luacheck: globals CMDER_SESSION
-- luacheck: globals uah_color cwd_color lamb_color clean_color dirty_color conflict_color unknown_color
-- luacheck: globals prompt_homeSymbol prompt_lambSymbol prompt_type prompt_useHomeSymbol prompt_useUserAtHost
-- luacheck: globals prompt_singleLine prompt_includeVersionControl
-- luacheck: globals prompt_overrideGitStatusOptIn prompt_overrideSvnStatusOptIn
-- luacheck: globals clink io.popenyield os.isdir settings.get
-- luacheck: globals clink
-- At first, load the original clink.lua file
-- this is needed as we set the script path to this dir and therefore the original
@ -51,37 +46,11 @@ local function get_unknown_color()
end
---
-- Escapes special characters in a string.gsub `find` parameter, so that it
-- can be matched as a literal plain text string, i.e. disable Lua pattern
-- matching. See "Patterns" (https://www.lua.org/manual/5.2/manual.html#6.4.1).
-- @param {string} text Text to escape
-- @returns {string} Escaped text
-- Makes a string safe to use as the replacement in string.gsub
---
local function escape_gsub_find_arg(text)
return text and text:gsub("([-+*?.%%()%[%]$^])", "%%%1") or ""
end
---
-- Escapes special characters in a string.gsub `replace` parameter, so that it
-- can be replaced as a literal plain text string, i.e. disable Lua pattern
-- matching. See "Patterns" (https://www.lua.org/manual/5.2/manual.html#6.4.1).
-- @param {string} text Text to escape
-- @returns {string} Escaped text
---
local function escape_gsub_replace_arg(text)
return text and text:gsub("%%", "%%%%") or ""
end
---
-- Perform string.sub, but disable Lua pattern matching and just treat both
-- the `find` and `replace` parameters as a literal plain text replacement.
-- @param {string} str Text in which to perform find and replace
-- @param {string} find Text to find (plain text; not a Lua pattern)
-- @param {string} replace Replacement text (plain text; not a Lua pattern)
-- @returns {string} Copy of the input `str` with `find` replaced by `replace`
---
local function gsub_plain(str, find, replace)
return string.gsub(str, escape_gsub_find_arg(find), escape_gsub_replace_arg(replace))
local function verbatim(s)
s = string.gsub(s, "%%", "%%%%")
return s
end
-- Extracts only the folder name from the input Path
@ -179,15 +148,15 @@ local function set_prompt_filter()
end
if prompt_useHomeSymbol and string.find(cwd, clink.get_env("HOME")) then
cwd = gsub_plain(cwd, clink.get_env("HOME"), prompt_homeSymbol)
cwd = string.gsub(cwd, clink.get_env("HOME"), prompt_homeSymbol)
end
local uah = ''
uah = ''
if prompt_useUserAtHost then
uah = clink.get_env("USERNAME") .. "@" .. clink.get_env("COMPUTERNAME") .. ' '
end
local cr = "\n"
cr = "\n"
if prompt_singleLine then
cr = ' '
end
@ -201,15 +170,15 @@ local function set_prompt_filter()
local version_control = prompt_includeVersionControl and "{git}{hg}{svn}" or ""
local prompt = "{uah}{cwd}" .. version_control .. cr .. get_lamb_color() .. "{env}{lamb}\x1b[0m "
prompt = gsub_plain(prompt, "{uah}", uah)
prompt = gsub_plain(prompt, "{cwd}", cwd)
prompt = gsub_plain(prompt, "{env}", env)
clink.prompt.value = gsub_plain(prompt, "{lamb}", prompt_lambSymbol)
prompt = "{uah}{cwd}" .. version_control .. cr .. get_lamb_color() .. "{env}{lamb}\x1b[0m "
prompt = string.gsub(prompt, "{uah}", uah)
prompt = string.gsub(prompt, "{cwd}", cwd)
prompt = string.gsub(prompt, "{env}", env)
clink.prompt.value = string.gsub(prompt, "{lamb}", prompt_lambSymbol)
end
local function percent_prompt_filter()
clink.prompt.value = gsub_plain(clink.prompt.value, "{percent}", "%")
clink.prompt.value = string.gsub(clink.prompt.value, "{percent}", "%%")
end
---
@ -222,7 +191,7 @@ end
local function get_dir_contains(path, dirname)
-- return parent path for specified entry (either file or directory)
local function pathname(path) -- luacheck: ignore 432
local function pathname(path)
local prefix = ""
local i = path:find("[\\/:][^\\/:]*$")
if i then
@ -232,14 +201,14 @@ local function get_dir_contains(path, dirname)
end
-- Navigates up one level
local function up_one_level(path) -- luacheck: ignore 432
local function up_one_level(path)
if path == nil then path = '.' end
if path == '.' then path = clink.get_cwd() end
return pathname(path)
end
-- Checks if provided directory contains git directory
local function has_specified_dir(path, specified_dir) -- luacheck: ignore 432
local function has_specified_dir(path, specified_dir)
if path == nil then path = '.' end
local found_dirs = clink.find_dirs(path..'/'..specified_dir)
if #found_dirs > 0 then return true end
@ -267,7 +236,7 @@ end
local function get_git_dir(path)
-- return parent path for specified entry (either file or directory)
local function pathname(path) -- luacheck: ignore 432
local function pathname(path)
local prefix = ""
local i = path:find("[\\/:][^\\/:]*$")
if i then
@ -286,8 +255,7 @@ local function get_git_dir(path)
local gitfile = io.open(dir..'/.git')
if not gitfile then return false end
local line = gitfile:read() or ''
local git_dir = line:match('gitdir: (.*)')
local git_dir = gitfile:read():match('gitdir: (.*)')
gitfile:close()
if os.isdir then -- only available in Clink v1.0.0 and higher
@ -335,9 +303,6 @@ local function get_git_branch(git_dir)
local HEAD = head_file:read()
head_file:close()
-- If HEAD is missing, something is wrong.
if not HEAD then return end
-- if HEAD matches branch expression, then we're on named branch
-- otherwise it is a detached commit
local branch_name = HEAD:match('ref: refs/heads/(.+)')
@ -357,9 +322,6 @@ local function get_hg_branch()
-- local cmd = "hg prompt \"{branch}{status}{|{patch}}{update}\""
local cmd = "hg branch 2>nul"
local file = io.popen(cmd)
if not file then
return false
end
for line in file:lines() do
local m = line:match("(.+)$")
@ -377,12 +339,8 @@ end
-- Find out current branch
-- @return {false|svn branch name}
---
local function get_svn_branch()
local function get_svn_branch(svn_dir)
local file = io_popenyield("svn info 2>nul")
if not file then
return false
end
for line in file:lines() do
local m = line:match("^Relative URL:")
if m then
@ -401,16 +359,12 @@ end
---
local function get_git_status()
local file = io_popenyield("git --no-optional-locks status --porcelain 2>nul")
if not file then
return {}
end
local conflict_found = false
local is_status = true
for line in file:lines() do
local code = line:sub(1, 2)
-- print (string.format("code: %s, line: %s", code, line))
if code == "DD" or code == "AU" or code == "UD" or code == "UA" or code == "DU" or code == "AA" or code == "UU" then -- luacheck: no max line length
if code == "DD" or code == "AU" or code == "UD" or code == "UA" or code == "DU" or code == "AA" or code == "UU" then
is_status = false
conflict_found = true
break
@ -420,27 +374,38 @@ local function get_git_status()
end
end
file:close()
return { status = is_status, conflict = conflict_found }
end
---
-- Get the status of working dir
-- @return {bool}
---
local function get_hg_status()
local file = io.popen("hg status -0")
for line in file:lines() do
file:close()
return false
end
file:close()
return true
end
---
-- Get the status of working dir
-- @return {bool}
---
local function get_svn_status()
local file = io_popenyield("svn status -q")
if not file then
return { error = true }
end
for line in file:lines() do -- luacheck: ignore 512, no unused
for line in file:lines() do
file:close()
return { clean = false }
return false
end
file:close()
return { clean = true }
return true
end
---
@ -468,7 +433,6 @@ local function get_git_status_setting()
end
local gitStatusConfig = io_popenyield("git --no-pager config cmder.status 2>nul")
if gitStatusConfig then
for line in gitStatusConfig:lines() do
if string.match(line, 'false') then
gitStatusConfig:close()
@ -477,10 +441,8 @@ local function get_git_status_setting()
end
end
gitStatusConfig:close()
end
local gitCmdStatusConfig = io_popenyield("git --no-pager config cmder.cmdstatus 2>nul")
if gitCmdStatusConfig then
for line in gitCmdStatusConfig:lines() do
if string.match(line, 'false') then
gitCmdStatusConfig:close()
@ -489,7 +451,6 @@ local function get_git_status_setting()
end
end
gitCmdStatusConfig:close()
end
last_git_status_setting = true
return true
@ -558,13 +519,13 @@ local function git_prompt_filter()
color = colors.conflict
end
clink.prompt.value = gsub_plain(clink.prompt.value, "{git}", " "..color.."("..branch..")")
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", " "..color.."("..verbatim(branch)..")")
return false
end
end
-- No git present or not in git file
clink.prompt.value = gsub_plain(clink.prompt.value, "{git}", "")
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", "")
return false
end
@ -575,6 +536,8 @@ local function hg_prompt_filter()
return false
end
local result = ""
local hg_dir = get_hg_dir()
if hg_dir then
-- Colors for mercurial status
@ -596,20 +559,16 @@ local function hg_prompt_filter()
local color = colors.clean
local pipe = io.popen("hg status -amrd 2>&1")
if pipe then
output = pipe:read('*all')
pipe:close()
local output = pipe:read('*all')
local rc = { pipe:close() }
if output ~= nil and output ~= "" then color = colors.dirty end
result = color .. "(" .. branch .. ")"
end
end
local result = color .. "(" .. branch .. ")"
clink.prompt.value = gsub_plain(clink.prompt.value, "{hg}", " "..result)
clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", " "..verbatim(result))
return false
end
end
-- No hg present or not in hg repo
clink.prompt.value = gsub_plain(clink.prompt.value, "{hg}", "")
end
local function svn_prompt_filter()
@ -630,6 +589,7 @@ local function svn_prompt_filter()
if svn_dir then
-- if we're inside of svn repo then try to detect current branch
local branch = get_svn_branch()
local color
if branch then
-- If in a different repo or branch than last time, discard cached info
if cached_info.svn_dir ~= svn_dir or cached_info.svn_branch ~= branch then
@ -639,7 +599,7 @@ local function svn_prompt_filter()
end
-- Get the svn status using coroutine if available and option is enabled. Otherwise use a blocking call
local svnStatus
if clink.promptcoroutine and io.popenyield and settings.get("prompt.async") and prompt_overrideSvnStatusOptIn then -- luacheck: no max line length
if clink.promptcoroutine and io.popenyield and settings.get("prompt.async") and prompt_overrideSvnStatusOptIn then
svnStatus = clink_promptcoroutine(function ()
return get_svn_status()
end)
@ -653,22 +613,21 @@ local function svn_prompt_filter()
svnStatus = get_svn_status()
end
local color
if not svnStatus or svnStatus.error then
if svnStatus == nil then
color = colors.nostatus
elseif svnStatus.clean then
elseif svnStatus then
color = colors.clean
else
color = colors.dirty
end
clink.prompt.value = gsub_plain(clink.prompt.value, "{svn}", " "..color.."("..branch..")")
clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", " "..color.."("..verbatim(branch)..")")
return false
end
end
-- No svn present or not in svn file
clink.prompt.value = gsub_plain(clink.prompt.value, "{svn}", "")
clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", "")
return false
end

View File

@ -1,10 +1,6 @@
# For explanation of these and other settings see:
# https://chrisant996.github.io/clink/clink.html
# name: Expand envvars when completing
# type: boolean
match.expand_envvars = True
# name: Sets how command history expansion is applied
# type: enum
# options: off,on,not_squoted,not_dquoted,not_quoted

15
vendor/init.bat vendored
View File

@ -153,8 +153,7 @@ if not "%CMDER_SHELL%" == "cmd" (
set CMDER_ALIASES=0
)
:: Pick the right version of Clink
:: TODO: Support for ARM
:: Pick right version of Clink
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
set clink_architecture=x86
set architecture_bits=32
@ -167,7 +166,7 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" (
)
if "%CMDER_CLINK%" == "1" (
REM TODO: Detect if clink is already injected, if so goto :CLINK_FINISH
REM TODO: If clink is already injected, goto :CLINK_FINISH
goto :INJECT_CLINK
)
@ -206,10 +205,8 @@ goto :SKIP_CLINK
"%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor"
:: Check if a fatal error occurred when trying to inject Clink
if errorlevel 2 (
REM %print_error% "Clink injection has failed with error code: %errorlevel%"
goto :SKIP_CLINK
if errorlevel 1 (
%print_error% "Clink initialization has failed with error code: %errorlevel%"
)
goto :CLINK_FINISH
@ -240,8 +237,8 @@ if "%CMDER_CONFIGURED%" GTR "1" (
:: Prepare for git-for-windows
:: Detect which git.exe version to use
:: * if the user points to a specific git, use that
:: * test if git is in path and if yes, use that
:: * 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
:: also check that we have a recent enough version of git by examining the version string
if defined GIT_INSTALL_ROOT (

View File

@ -55,7 +55,6 @@ exit /b
set "GIT_VERSION=%%C"
) else (
echo "'git --version' returned an improper version string!"
%print_debug% :read_version "returned string: '%%A %%B %%C' by executable path: %git_executable%"
pause
exit /b
)

1
vendor/profile.ps1 vendored
View File

@ -28,6 +28,7 @@ if (!$ENV:CMDER_ROOT) {
# Remove trailing '\'
$ENV:CMDER_ROOT = ($ENV:CMDER_ROOT).TrimEnd("\")
# Do not load bundled PsGet if a module installer is already available
# -> recent PowerShell versions include PowerShellGet out of the box
$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue)

2155
vendor/psmodules/PsGet/PsGet.psm1 vendored Normal file

File diff suppressed because it is too large Load Diff

16
vendor/sources.json vendored
View File

@ -1,22 +1,22 @@
[
{
"name": "git-for-windows",
"version": "2.45.1.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.45.1.windows.1/PortableGit-2.45.1-64-bit.7z.exe"
"version": "2.40.0-rc2.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.40.0-rc2.windows.1/PortableGit-2.40.0-rc2-64-bit.7z.exe"
},
{
"name": "clink",
"version": "1.6.14",
"url": "https://github.com/chrisant996/clink/releases/download/v1.6.14/clink.1.6.14.93b83f.zip"
"version": "1.4.22",
"url": "https://github.com/chrisant996/clink/releases/download/v1.4.22/clink.1.4.22.33f515.zip"
},
{
"name": "conemu-maximus5",
"version": "23.07.24",
"url": "https://github.com/Maximus5/ConEmu/releases/download/v23.07.24/ConEmuPack.230724.7z"
"version": "22.12.18",
"url": "https://github.com/Maximus5/ConEmu/releases/download/v22.12.18/ConEmuPack.221218.7z"
},
{
"name": "clink-completions",
"version": "0.5.2",
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.5.2.zip"
"version": "0.4.7",
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.4.7.zip"
}
]