mirror of
https://github.com/cmderdev/cmder.git
synced 2025-07-17 04:59:09 +08:00
Compare commits
79 Commits
Author | SHA1 | Date | |
---|---|---|---|
bbcabfb730 | |||
75801cbdc8 | |||
9822fa844e | |||
a9f5d552bc | |||
63120b8998 | |||
8cdce27653 | |||
a5691285ec | |||
3223a0391a | |||
a39c632d71 | |||
8c6847ee0d | |||
f66f598fca | |||
de8d2d22f6 | |||
72c045dc2d | |||
5ee2fb2a8d | |||
2ba40773b3 | |||
662663813e | |||
2ec650557e | |||
932e517c2f | |||
6a9d6dd37e | |||
e9707b2022 | |||
ef91a9c272 | |||
9939b1ba7f | |||
c032b5f8a0 | |||
9ce90d337b | |||
2a722ee3f3 | |||
3cfd032007 | |||
21f0f1dbb2 | |||
38c13a7f4b | |||
97980f5f34 | |||
e3e1effef3 | |||
2542358965 | |||
6b37074dd5 | |||
1b7e647b4b | |||
e6618f21a3 | |||
56a9a2036f | |||
f6c3a0c390 | |||
46f6f677dc | |||
d5d8b0944b | |||
8e676b3fc7 | |||
b9379b3ae2 | |||
db49c14422 | |||
46bebee94c | |||
691000fa15 | |||
df064ec4be | |||
e1c60104ba | |||
3a8daf57f7 | |||
fa33052096 | |||
fe31accba4 | |||
3b053f8848 | |||
c76950293e | |||
ea22c658b7 | |||
303bfda521 | |||
1f8b0c009a | |||
cf74dba780 | |||
a9bfd2d2a2 | |||
b0b8eaef1e | |||
5243d8bb8d | |||
1225d410fa | |||
c661b1f300 | |||
4c1f96c51d | |||
f4b6d8f9a8 | |||
0314ee5d46 | |||
6a761a88c1 | |||
447be262f8 | |||
371ffbc069 | |||
6d0d93e0fd | |||
b4a264b1bc | |||
3bd0fe517f | |||
83cd726a41 | |||
b30056c4b3 | |||
7688823886 | |||
878499cc0b | |||
0f118fe42d | |||
f719f9d51f | |||
86d77b9e6b | |||
937df38131 | |||
4120875e33 | |||
c91f8ac461 | |||
e0540e43da |
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,6 +4,10 @@
|
||||
vendor/*
|
||||
!vendor/*.md
|
||||
!vendor/*.bat
|
||||
!vendor/*.json
|
||||
|
||||
config/.history
|
||||
Thumbs.db
|
||||
*.exe
|
||||
build/
|
||||
Version v*
|
26
Readme.md
26
Readme.md
@ -1,8 +1,8 @@
|
||||
# Cmder
|
||||
|
||||
Latest release is **[v1.1.2](https://github.com/bliker/cmder/releases/tag/v1.1.2)**
|
||||
Latest release is **[v1.1.4](https://github.com/bliker/cmder/releases/tag/v1.1.4)**
|
||||
|
||||
Cmder is a **software package** created out of pure frustration over absence of usable console emulator on Windows. It is based on [ConEmu](https://code.google.com/p/conemu-maximus5/) with *major* config overhaul. Monokai color scheme, amazing [clink](https://code.google.com/p/clink/) and custom prompt layout.
|
||||
Cmder is a **software package** created out of pure frustration over absence of usable console emulator on Windows. It is based on [ConEmu](https://code.google.com/p/conemu-maximus5/) with *major* config overhaul. Monokai color scheme, amazing [clink](https://github.com/mridgers/clink) and custom prompt layout.
|
||||
|
||||

|
||||
|
||||
@ -19,6 +19,20 @@ The main advantage of Cmder is portability. It is designed to be totally self-co
|
||||
|
||||
*(There will be a version with installer)*
|
||||
|
||||
## Integration
|
||||
|
||||
So you've experimented with cmder a little and want to give it a shot in a more permanent home;
|
||||
|
||||
### Shortcut to open Cmder in a chosen folder
|
||||
|
||||
1. Open a terminal as an Administrator
|
||||
1. Navigate to the directory you have placed Cmder
|
||||
1. Execute `.\cmder.exe /REGISTER ALL`*
|
||||
|
||||
In a file explorer window right click in or on a directory to see "Cmder Here" in the context menu.
|
||||
|
||||
*If you get a message "Access Denied" ensure you are executing the command in an Administrator prompt.
|
||||
|
||||
## Keyboard shortcuts
|
||||
|
||||
### Tab manipulation
|
||||
@ -26,7 +40,7 @@ The main advantage of Cmder is portability. It is designed to be totally self-co
|
||||
* `Ctrl + t` : new tab dialog (maybe you want to open cmd as admin?)
|
||||
* `Ctrl + w` : close tab
|
||||
* `Ctrl + d` : close tab (if pressed on empty command)
|
||||
* `Ctrl + alt + number` : fast new tab: `1` - CMD, `2` - Powershell `*` - More to come
|
||||
* `Shift + alt + number` : fast new tab: `1` - CMD, `2` - Powershell `*` - More to come
|
||||
* `Alt + enter`: Fullscreen
|
||||
|
||||
### Shell
|
||||
@ -49,7 +63,11 @@ All aliases will be saved in `/config/aliases` file
|
||||
|
||||
## Todo
|
||||
|
||||
1. Write a Todo list
|
||||
1. Complete PowerShell compatibility.
|
||||
2. Workaround git.exe overload after msysgit download (Granted this is an upstream issue).
|
||||
3. Redo Build/Pack scripts or remove them altogether.
|
||||
4. Git Bash
|
||||
5. Check for clink and git before injecting them
|
||||
|
||||
## License
|
||||
|
||||
|
110
build.rb
110
build.rb
@ -1,110 +0,0 @@
|
||||
# Samuel Vasko 2013
|
||||
# Cmder build script
|
||||
# Like really a beta
|
||||
#
|
||||
# This script downloads dependencies form google code. Each software is extracted
|
||||
# in a folder with same name as the project on google code. So Conemu becomes
|
||||
# conemu-maximus5. Correct files are beeing picked by using labels.
|
||||
# I will move the script for getting files by labels from php to here as soon I feel like it
|
||||
|
||||
require 'fileutils'
|
||||
require 'open-uri'
|
||||
require 'uri'
|
||||
|
||||
def get_file project, query
|
||||
urlToFile = URI.escape('http://samuelvasko.tk/gcode/?project='+project+'&query='+query)
|
||||
open(urlToFile) do |resp|
|
||||
urlToFile = URI.escape(resp.read.split(/\r?\n/).first)
|
||||
end
|
||||
|
||||
extension = urlToFile.split('.').last
|
||||
filename = project+'.'+extension
|
||||
|
||||
puts "\n ------ Downloading #{project} from #{urlToFile} ------- \n \n"
|
||||
begin
|
||||
open(urlToFile, 'rb') do |infile|
|
||||
open(filename, 'wb') do |outfile|
|
||||
outfile.write(infile.read)
|
||||
end
|
||||
end
|
||||
rescue IOError => error
|
||||
puts error
|
||||
FileUtils.rm(filename) if File.exists?(filename)
|
||||
exit(1)
|
||||
end
|
||||
|
||||
system("7z x -o\"#{project}\" #{filename}")
|
||||
|
||||
File.unlink(project+"."+extension);
|
||||
|
||||
# When the folder contains another folder
|
||||
# that is not what we want
|
||||
if Dir.glob("#{project}/*").length == 1
|
||||
temp_name = "#{project}_temp"
|
||||
FileUtils.mv(project, temp_name)
|
||||
FileUtils.mv(Dir.glob("#{temp_name}/*")[0], project)
|
||||
FileUtils.rm_r(temp_name)
|
||||
end
|
||||
end
|
||||
|
||||
def find_on_path exe
|
||||
path = ENV['PATH'].split(File::PATH_SEPARATOR)
|
||||
for dir in path
|
||||
if File.exists?(File.join(dir, exe))
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
puts '
|
||||
______ _ _ _ _ _
|
||||
| ___ \ (_) | | (_) | |
|
||||
| |_/ /_ _ _| | __| |_ _ __ __ _ ___ _ __ ___ __| | ___ _ __
|
||||
| ___ \ | | | | |/ _` | | \'_ \ / _` | / __| \'_ ` _ \ / _` |/ _ \ \'__|
|
||||
| |_/ / |_| | | | (_| | | | | | (_| | | (__| | | | | | (_| | __/ |
|
||||
\____/ \__,_|_|_|\__,_|_|_| |_|\__, | \___|_| |_| |_|\__,_|\___|_|
|
||||
__/ |
|
||||
|___/
|
||||
'
|
||||
|
||||
unless find_on_path('7z.exe')
|
||||
puts '7z.exe not found. Ensure 7-zip is installed and on the PATH.'
|
||||
exit(1)
|
||||
end
|
||||
|
||||
build_exe = true
|
||||
unless find_on_path('msbuild.exe')
|
||||
puts 'msbuild.exe not found. We need that to build the executable.'
|
||||
puts 'Do you want to continue? [Y/n]'
|
||||
build_exe = false
|
||||
exit(1) unless gets.chomp.downcase == 'y'
|
||||
end
|
||||
|
||||
puts 'Cleanup'
|
||||
|
||||
if Dir.exists?('vendor')
|
||||
Dir.glob('vendor/*') { |file| FileUtils.rm_rf(file) if File.directory?(file) }
|
||||
end
|
||||
|
||||
Dir.chdir('vendor')
|
||||
|
||||
puts 'Getting files'
|
||||
|
||||
get_file('clink', 'label:Type-Archive label:Featured')
|
||||
get_file('conemu-maximus5', 'label:Type-Archive label:Preview label:Featured')
|
||||
get_file('msysgit', 'label:Type-Archive label:Featured')
|
||||
|
||||
puts 'Creating executable'
|
||||
|
||||
if build_exe
|
||||
Dir.chdir('../launcher')
|
||||
status = system('msbuild /p:Configuration=Release')
|
||||
unless status
|
||||
puts 'Looks like the build failied'
|
||||
exit(1)
|
||||
end
|
||||
end
|
||||
|
||||
puts 'Done, bye'
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<key name="Software">
|
||||
<key name="ConEmu">
|
||||
<key name=".Vanilla" modified="2013-11-29 16:19:40" build="131107">
|
||||
<key name=".Vanilla" modified="2014-01-21 18:36:36" build="131215">
|
||||
<value name="ColorTable00" type="dword" data="00222827"/>
|
||||
<value name="ColorTable01" type="dword" data="009e5401"/>
|
||||
<value name="ColorTable02" type="dword" data="0004aa74"/>
|
||||
@ -18,21 +18,21 @@
|
||||
<value name="ColorTable13" type="dword" data="00b87da8"/>
|
||||
<value name="ColorTable14" type="dword" data="0081cccc"/>
|
||||
<value name="ColorTable15" type="dword" data="00ffffff"/>
|
||||
<value name="ColorTable16" type="dword" data="00000000"/>
|
||||
<value name="ColorTable17" type="dword" data="00800000"/>
|
||||
<value name="ColorTable18" type="dword" data="00008000"/>
|
||||
<value name="ColorTable19" type="dword" data="00808000"/>
|
||||
<value name="ColorTable20" type="dword" data="00000080"/>
|
||||
<value name="ColorTable21" type="dword" data="00800080"/>
|
||||
<value name="ColorTable22" type="dword" data="00008080"/>
|
||||
<value name="ColorTable23" type="dword" data="00c0c0c0"/>
|
||||
<value name="ColorTable24" type="dword" data="00808080"/>
|
||||
<value name="ColorTable25" type="dword" data="00ff0000"/>
|
||||
<value name="ColorTable26" type="dword" data="0000ff00"/>
|
||||
<value name="ColorTable27" type="dword" data="00ffff00"/>
|
||||
<value name="ColorTable28" type="dword" data="000000ff"/>
|
||||
<value name="ColorTable29" type="dword" data="00ff00ff"/>
|
||||
<value name="ColorTable30" type="dword" data="0000ffff"/>
|
||||
<value name="ColorTable16" type="dword" data="00222827"/>
|
||||
<value name="ColorTable17" type="dword" data="009e5401"/>
|
||||
<value name="ColorTable18" type="dword" data="0004aa74"/>
|
||||
<value name="ColorTable19" type="dword" data="00a6831a"/>
|
||||
<value name="ColorTable20" type="dword" data="003403a7"/>
|
||||
<value name="ColorTable21" type="dword" data="009c5689"/>
|
||||
<value name="ColorTable22" type="dword" data="0049b6b6"/>
|
||||
<value name="ColorTable23" type="dword" data="00cacaca"/>
|
||||
<value name="ColorTable24" type="dword" data="007c7c7c"/>
|
||||
<value name="ColorTable25" type="dword" data="00f58303"/>
|
||||
<value name="ColorTable26" type="dword" data="0006d08d"/>
|
||||
<value name="ColorTable27" type="dword" data="00e5c258"/>
|
||||
<value name="ColorTable28" type="dword" data="004b04f3"/>
|
||||
<value name="ColorTable29" type="dword" data="00b87da8"/>
|
||||
<value name="ColorTable30" type="dword" data="0081cccc"/>
|
||||
<value name="ColorTable31" type="dword" data="00ffffff"/>
|
||||
<value name="ExtendColors" type="hex" data="00"/>
|
||||
<value name="ExtendColorIdx" type="hex" data="0e"/>
|
||||
@ -53,7 +53,7 @@
|
||||
<value name="ClipboardArrowStart" type="hex" data="00"/>
|
||||
<value name="ClipboardAllLines" type="hex" data="01"/>
|
||||
<value name="ClipboardFirstLine" type="hex" data="01"/>
|
||||
<value name="ClipboardClickPromptPosition" type="hex" data="02"/>
|
||||
<value name="ClipboardClickPromptPosition" type="hex" data="00"/>
|
||||
<value name="ClipboardDeleteLeftWord" type="hex" data="01"/>
|
||||
<value name="TrueColorerSupport" type="hex" data="01"/>
|
||||
<value name="FadeInactive" type="hex" data="01"/>
|
||||
@ -349,7 +349,7 @@
|
||||
<value name="SwitchGuiFocus" type="dword" data="00000000"/>
|
||||
<value name="SetFocusGui" type="dword" data="00000000"/>
|
||||
<value name="SetFocusChild" type="dword" data="00000000"/>
|
||||
<value name="ChildSystemMenu" type="dword" data="00000000"/>
|
||||
<value name="ChildSystemMenu" type="dword" data="006b2d288000000"/>
|
||||
<value name="Multi.NewConsole" type="dword" data="80808000"/>
|
||||
<value name="Multi.NewConsoleShift" type="dword" data="00001154"/>
|
||||
<value name="Multi.NewConsolePopup" type="dword" data="80808000"/>
|
||||
@ -415,10 +415,10 @@
|
||||
<value name="KeyMacro01.Text" type="string" data="Task("cmd")"/>
|
||||
<value name="KeyMacro02" type="dword" data="0012a032"/>
|
||||
<value name="KeyMacro02.Text" type="string" data="Task("PowerShell")"/>
|
||||
<value name="KeyMacro03" type="dword" data="00000000"/>
|
||||
<value name="KeyMacro03.Text" type="string" data=""/>
|
||||
<value name="KeyMacro04" type="dword" data="00000000"/>
|
||||
<value name="KeyMacro04.Text" type="string" data=""/>
|
||||
<value name="KeyMacro03" type="dword" data="000011d0"/>
|
||||
<value name="KeyMacro03.Text" type="string" data="FontSetSize(1,2)"/>
|
||||
<value name="KeyMacro04" type="dword" data="000011d1"/>
|
||||
<value name="KeyMacro04.Text" type="string" data="FontSetSize(1,-2)"/>
|
||||
<value name="KeyMacro05" type="dword" data="00000000"/>
|
||||
<value name="KeyMacro05.Text" type="string" data=""/>
|
||||
<value name="KeyMacro06" type="dword" data="00000000"/>
|
||||
@ -483,17 +483,17 @@
|
||||
<value name="DndLKey" type="hex" data="00"/>
|
||||
<value name="DndRKey" type="hex" data="a2"/>
|
||||
<value name="WndDragKey" type="dword" data="00121101"/>
|
||||
<key name="Tasks" modified="2013-11-29 16:19:41" build="131107">
|
||||
<key name="Tasks" modified="2014-01-21 18:36:36" build="131215">
|
||||
<value name="Count" type="dword" data="00000002"/>
|
||||
<key name="Task1" modified="2013-11-29 16:19:41" build="131107">
|
||||
<key name="Task1" modified="2014-01-21 18:36:36" build="131215">
|
||||
<value name="Name" type="string" data="{cmd}"/>
|
||||
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\cmder.exe""/>
|
||||
<value name="Cmd1" type="string" data="cmd /k "%CMDER_ROOT%\vendor\init.bat" -new_console:d:%USERPROFILE%"/>
|
||||
<value name="Cmd1" type="string" data="cmd /k "%ConEmuDir%\..\init.bat" -new_console:d:%HOME%"/>
|
||||
<value name="Active" type="dword" data="00000000"/>
|
||||
<value name="Count" type="dword" data="00000001"/>
|
||||
<value name="Hotkey" type="dword" data="00000000"/>
|
||||
</key>
|
||||
<key name="Task2" modified="2013-11-29 16:19:41" build="131107">
|
||||
<key name="Task2" modified="2014-01-21 18:36:36" build="131215">
|
||||
<value name="Name" type="string" data="{PowerShell}"/>
|
||||
<value name="GuiArgs" type="string" data="/dir "%userprofile%""/>
|
||||
<value name="Cmd1" type="string" data="powershell"/>
|
||||
@ -502,11 +502,11 @@
|
||||
<value name="Hotkey" type="dword" data="00000000"/>
|
||||
</key>
|
||||
</key>
|
||||
<key name="Apps" modified="2013-11-29 16:19:41" build="131107">
|
||||
<key name="Apps" modified="2014-01-21 18:36:36" build="131215">
|
||||
<value name="Count" type="dword" data="00000000"/>
|
||||
</key>
|
||||
<key name="Colors" modified="2013-11-29 16:19:41" build="131107">
|
||||
<key name="Palette1" modified="2013-11-29 16:19:41" build="131107">
|
||||
<key name="Colors" modified="2014-01-21 18:36:36" build="131215">
|
||||
<key name="Palette1" modified="2014-01-21 18:36:36" build="131215">
|
||||
<value name="Name" type="string" data="Monokai"/>
|
||||
<value name="ExtendColors" type="hex" data="00"/>
|
||||
<value name="ExtendColorIdx" type="hex" data="0e"/>
|
||||
@ -573,6 +573,14 @@
|
||||
<value name="CTS.VkCopyFmt0" type="dword" data="00001143"/>
|
||||
<value name="CTS.VkCopyFmt1" type="dword" data="00101143"/>
|
||||
<value name="CTS.VkCopyFmt2" type="dword" data="00000000"/>
|
||||
<value name="ProcessNewConArg" type="hex" data="01"/>
|
||||
<value name="HighlightMouseRow" type="hex" data="00"/>
|
||||
<value name="HighlightMouseCol" type="hex" data="00"/>
|
||||
<value name="HighlightMouseSwitch" type="dword" data="00005d4c"/>
|
||||
<value name="TransparencyInc" type="dword" data="00000000"/>
|
||||
<value name="TransparencyDec" type="dword" data="00000000"/>
|
||||
<value name="Key.MaximizeWidth" type="dword" data="00000000"/>
|
||||
<value name="Key.MaximizeHeight" type="dword" data="00000000"/>
|
||||
</key>
|
||||
</key>
|
||||
</key>
|
||||
|
@ -2,3 +2,4 @@ e.=explorer .
|
||||
gl=git log --oneline --all --graph --decorate $*
|
||||
ls=ls --color $*
|
||||
pwd=cd
|
||||
clear=cls
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
# Visual Studio Express 2013 for Windows Desktop
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CmderLauncher", "CmderLauncher.vcxproj", "{4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3}"
|
||||
|
@ -12,8 +12,11 @@
|
||||
|
||||
#define USE_TASKBAR_API (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
|
||||
|
||||
#define XP (_WIN32_WINNT < _WIN32_WINNT_VISTA)
|
||||
|
||||
#define MB_TITLE L"Cmder Launcher"
|
||||
#define SHELL_MENU_REGISTRY_PATH L"Directory\\Background\\shell\\Cmder"
|
||||
#define SHELL_MENU_REGISTRY_PATH_BACKGROUND L"Directory\\Background\\shell\\Cmder"
|
||||
#define SHELL_MENU_REGISTRY_PATH_LISTITEM L"Directory\\shell\\Cmder"
|
||||
|
||||
#define streqi(a, b) (_wcsicmp((a), (b)) == 0)
|
||||
|
||||
@ -154,30 +157,42 @@ HKEY GetRootKey(std::wstring opt)
|
||||
return root;
|
||||
}
|
||||
|
||||
void RegisterShellMenu(std::wstring opt)
|
||||
void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName)
|
||||
{
|
||||
HKEY root = GetRootKey(opt);
|
||||
|
||||
HKEY cmderKey;
|
||||
FAIL_ON_ERROR(
|
||||
RegCreateKeyEx(root, SHELL_MENU_REGISTRY_PATH, 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL));
|
||||
|
||||
FAIL_ON_ERROR(RegSetValue(cmderKey, L"", REG_SZ, L"Cmder Here", NULL));
|
||||
FAIL_ON_ERROR(RegSetValueEx(cmderKey, L"NoWorkingDirectory", 0, REG_SZ, (BYTE *)L"", 2));
|
||||
|
||||
HKEY command;
|
||||
FAIL_ON_ERROR(
|
||||
RegCreateKeyEx(cmderKey, L"command", 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &command, NULL));
|
||||
// First, get the paths we will use
|
||||
|
||||
wchar_t exePath[MAX_PATH] = { 0 };
|
||||
wchar_t icoPath[MAX_PATH] = { 0 };
|
||||
|
||||
GetModuleFileName(NULL, exePath, sizeof(exePath));
|
||||
|
||||
wchar_t commandStr[MAX_PATH + 20] = { 0 };
|
||||
swprintf_s(commandStr, L"\"%s\" \"%%V\"", exePath);
|
||||
|
||||
// Now that we have `commandStr`, it's OK to change `exePath`...
|
||||
PathRemoveFileSpec(exePath);
|
||||
|
||||
PathCombine(icoPath, exePath, L"icons\\cmder.ico");
|
||||
|
||||
// Now set the registry keys
|
||||
|
||||
HKEY root = GetRootKey(opt);
|
||||
|
||||
HKEY cmderKey;
|
||||
FAIL_ON_ERROR(
|
||||
RegCreateKeyEx(root, keyBaseName, 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL));
|
||||
|
||||
FAIL_ON_ERROR(RegSetValue(cmderKey, L"", REG_SZ, L"Cmder Here", NULL));
|
||||
FAIL_ON_ERROR(RegSetValueEx(cmderKey, L"NoWorkingDirectory", 0, REG_SZ, (BYTE *)L"", 2));
|
||||
|
||||
FAIL_ON_ERROR(RegSetValueEx(cmderKey, L"Icon", 0, REG_SZ, (BYTE *)icoPath, wcslen(icoPath) * sizeof(wchar_t)));
|
||||
|
||||
HKEY command;
|
||||
FAIL_ON_ERROR(
|
||||
RegCreateKeyEx(cmderKey, L"command", 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &command, NULL));
|
||||
|
||||
FAIL_ON_ERROR(RegSetValue(command, L"", REG_SZ, commandStr, NULL));
|
||||
|
||||
RegCloseKey(command);
|
||||
@ -185,15 +200,18 @@ void RegisterShellMenu(std::wstring opt)
|
||||
RegCloseKey(root);
|
||||
}
|
||||
|
||||
void UnregisterShellMenu(std::wstring opt)
|
||||
void UnregisterShellMenu(std::wstring opt, wchar_t* keyBaseName)
|
||||
{
|
||||
HKEY root = GetRootKey(opt);
|
||||
HKEY cmderKey;
|
||||
FAIL_ON_ERROR(
|
||||
RegCreateKeyEx(root, SHELL_MENU_REGISTRY_PATH, 0, NULL,
|
||||
RegCreateKeyEx(root, keyBaseName, 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL));
|
||||
#if XP
|
||||
FAIL_ON_ERROR(SHDeleteKey(cmderKey, NULL));
|
||||
#else
|
||||
FAIL_ON_ERROR(RegDeleteTree(cmderKey, NULL));
|
||||
FAIL_ON_ERROR(RegDeleteKey(root, SHELL_MENU_REGISTRY_PATH));
|
||||
#endif
|
||||
RegCloseKey(cmderKey);
|
||||
RegCloseKey(root);
|
||||
}
|
||||
@ -215,11 +233,13 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
}
|
||||
else if (streqi(opt.first.c_str(), L"/REGISTER"))
|
||||
{
|
||||
RegisterShellMenu(opt.second);
|
||||
RegisterShellMenu(opt.second, SHELL_MENU_REGISTRY_PATH_BACKGROUND);
|
||||
RegisterShellMenu(opt.second, SHELL_MENU_REGISTRY_PATH_LISTITEM);
|
||||
}
|
||||
else if (streqi(opt.first.c_str(), L"/UNREGISTER"))
|
||||
{
|
||||
UnregisterShellMenu(opt.second);
|
||||
UnregisterShellMenu(opt.second, SHELL_MENU_REGISTRY_PATH_BACKGROUND);
|
||||
UnregisterShellMenu(opt.second, SHELL_MENU_REGISTRY_PATH_LISTITEM);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -228,4 +248,4 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
40
pack.rb
40
pack.rb
@ -1,40 +0,0 @@
|
||||
# Samuel Vasko 2013
|
||||
# Cmder packing script -- Creates zip files for relase
|
||||
|
||||
require "fileutils"
|
||||
|
||||
def create_archive name, exclude
|
||||
if exclude
|
||||
exclude = " -x!cmder\\" + exclude
|
||||
else
|
||||
exclude = ""
|
||||
end
|
||||
system('ls')
|
||||
puts "Running 7z a -x@cmder\\packignore" + exclude + " " + name + " cmder"
|
||||
system("7z a -x@cmder\\packignore" + exclude + " " + name + " cmder")
|
||||
end
|
||||
|
||||
targets = [
|
||||
["cmder.zip"],
|
||||
["cmder.7z"],
|
||||
["cmder_mini.zip", "vendor\\msysgit"]
|
||||
]
|
||||
|
||||
unless system("git describe --abbrev=0 --tags")
|
||||
puts "Failied to get the last tag from git, looks like something is missing"
|
||||
end
|
||||
|
||||
version = `git describe --abbrev=0 --tags`
|
||||
|
||||
FileUtils.touch('Version ' + version.chomp)
|
||||
FileUtils.rm('config/.history')
|
||||
|
||||
Dir.chdir('..')
|
||||
|
||||
targets.each do |ar|
|
||||
create_archive ar[0], ar[1]
|
||||
end
|
||||
|
||||
Dir.chdir('cmder')
|
||||
|
||||
FileUtils.rm('Version ' + version.chomp)
|
18
packignore
18
packignore
@ -1,8 +1,10 @@
|
||||
cmder\launcher
|
||||
cmder\icons
|
||||
cmder\.gitignore
|
||||
cmder\.gitattributes
|
||||
cmder\.git
|
||||
cmder\*.rb
|
||||
cmder\packignore
|
||||
cmder\Cmder.bat
|
||||
launcher
|
||||
icons
|
||||
.gitignore
|
||||
.gitattributes
|
||||
.git
|
||||
*.rb
|
||||
build
|
||||
config\.history
|
||||
packignore
|
||||
Cmder.bat
|
79
scripts/build.ps1
Normal file
79
scripts/build.ps1
Normal file
@ -0,0 +1,79 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Build Cmder
|
||||
.DESCRIPTION
|
||||
Use this script to build your own edition of Cmder
|
||||
|
||||
This script builds dependencies from current vendor/sources.json file and unpacks them.
|
||||
|
||||
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
|
||||
.EXAMPLE
|
||||
.\build.ps1
|
||||
|
||||
Executes the default build for cmder, this is equivalent to the "minimum" style package in the releases
|
||||
.EXAMPLE
|
||||
.\build -verbose
|
||||
|
||||
Execute the build and see what's going on.
|
||||
.EXAMPLE
|
||||
.\build.ps1 -SourcesPath '~/custom/vendors.json'
|
||||
|
||||
Build cmder with your own packages. See vendor/sources.json for the syntax you need to copy.
|
||||
.NOTES
|
||||
AUTHORS
|
||||
Samuel Vasko, Jack Bennett
|
||||
Part of the Cmder project.
|
||||
.LINK
|
||||
https://github.com/bliker/cmder - Project Home
|
||||
#>
|
||||
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
Param(
|
||||
# CmdletBinding will give us;
|
||||
# -verbose switch to turn on logging and
|
||||
# -whatif switch to not actually make changes
|
||||
|
||||
# Path to the vendor configuration source file
|
||||
[string]$sourcesPath = "..\vendor\sources.json",
|
||||
|
||||
# Vendor folder location
|
||||
[string]$saveTo = "..\vendor\",
|
||||
|
||||
# Launcher folder location
|
||||
[string]$launcher = "..\launcher"
|
||||
)
|
||||
|
||||
. "$PSScriptRoot\utils.ps1"
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Push-Location -Path $saveTo
|
||||
$sources = Get-Content $sourcesPath | Out-String | Convertfrom-Json
|
||||
|
||||
# Check for requirements
|
||||
Ensure-Exists $sourcesPath
|
||||
Ensure-Executable "7z"
|
||||
|
||||
foreach ($s in $sources) {
|
||||
Write-Verbose "Getting $($s.name) from URL $($s.url)"
|
||||
|
||||
# We do not care about the extensions/type of archive
|
||||
$tempArchive = "$($s.name).tmp"
|
||||
Delete-Existing $tempArchive
|
||||
Delete-Existing $s.name
|
||||
|
||||
Invoke-WebRequest -Uri $s.url -OutFile $tempArchive -ErrorAction Stop
|
||||
Extract-Archive $tempArchive $s.name
|
||||
|
||||
if ((Get-Childitem $s.name).Count -eq 1) {
|
||||
Flatten-Directory($s.name)
|
||||
}
|
||||
}
|
||||
|
||||
Pop-Location
|
||||
|
||||
Push-Location -Path $launcher
|
||||
msbuild CmderLauncher.vcxproj /p:configuration=Release
|
||||
Pop-Location
|
||||
|
||||
Write-Verbose "All good and done!"
|
57
scripts/pack.ps1
Normal file
57
scripts/pack.ps1
Normal file
@ -0,0 +1,57 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Pack cmder
|
||||
.DESCRIPTION
|
||||
Use this script to pack cmder into release archives
|
||||
|
||||
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 .\pack.ps1
|
||||
.EXAMPLE
|
||||
.\pack.ps1
|
||||
|
||||
Creates default archives for cmder
|
||||
.EXAMPLE
|
||||
.\build -verbose
|
||||
|
||||
Creates default archives for cmder with plenty of information
|
||||
.NOTES
|
||||
AUTHORS
|
||||
Samuel Vasko, Jack Bennett
|
||||
Part of the Cmder project.
|
||||
.LINK
|
||||
https://github.com/bliker/cmder - Project Home
|
||||
#>
|
||||
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
Param(
|
||||
# CmdletBinding will give us;
|
||||
# -verbose switch to turn on logging and
|
||||
# -whatif switch to not actually make changes
|
||||
|
||||
# Path to the vendor configuration source file
|
||||
[string]$cmderRoot = "..",
|
||||
|
||||
# Vendor folder locaton
|
||||
[string]$saveTo = "..\build"
|
||||
)
|
||||
|
||||
. "$PSScriptRoot\utils.ps1"
|
||||
$ErrorActionPreference = "Stop"
|
||||
Ensure-Executable "7z"
|
||||
|
||||
$targets = @{
|
||||
"cmder.zip" = $null;
|
||||
"cmder.7z" = $null;
|
||||
"cmder_mini.zip" = "-x!`"vendor\msysgit`"";
|
||||
}
|
||||
|
||||
Delete-Existing "..\Version*"
|
||||
|
||||
$version = Invoke-Expression "git describe --abbrev=0 --tags"
|
||||
(New-Item -ItemType file "$cmderRoot\Version $version") | Out-Null
|
||||
|
||||
foreach ($t in $targets.GetEnumerator()) {
|
||||
Create-Archive $cmderRoot "$saveTo\$($t.Name)" $t.Value
|
||||
$hash = (Digest-MD5 "$saveTo\$($t.Name)")
|
||||
Add-Content "$saveTo\hashes.txt" $hash
|
||||
}
|
58
scripts/utils.ps1
Normal file
58
scripts/utils.ps1
Normal file
@ -0,0 +1,58 @@
|
||||
function Ensure-Exists ($path) {
|
||||
if (-not (Test-Path $path)) {
|
||||
Write-Error "Missing required $path! Ensure it is installed"
|
||||
exit 1
|
||||
}
|
||||
return $true > $null
|
||||
}
|
||||
|
||||
function Ensure-Executable ($command) {
|
||||
try { Get-Command $command -ErrorAction Stop > $null }
|
||||
catch {
|
||||
If( ($command -eq "7z") -and (Test-Path "$env:programfiles\7-zip\7z.exe") ){
|
||||
set-alias -Name "7z" -Value "$env:programfiles\7-zip\7z.exe" -Scope script
|
||||
}
|
||||
ElseIf( ($command -eq "7z") -and (Test-Path "$env:programw6432\7-zip\7z.exe") ) {
|
||||
set-alias -Name "7z" -Value "$env:programw6432\7-zip\7z.exe" -Scope script
|
||||
}
|
||||
Else {
|
||||
Write-Error "Missing $command! Ensure it is installed and on in the PATH"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Delete-Existing ($path) {
|
||||
Write-Verbose "Remove $path"
|
||||
Remove-Item -Recurse -force $path -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
function Extract-Archive ($source, $target) {
|
||||
Invoke-Expression "7z x -y -o$($target) $source > `$null"
|
||||
if ($lastexitcode -ne 0) {
|
||||
Write-Error "Extracting of $source failied"
|
||||
}
|
||||
Remove-Item $source
|
||||
}
|
||||
|
||||
function Create-Archive ($source, $target, $params) {
|
||||
$command = "7z a -x@`"$source\packignore`" $params $target $source > `$null"
|
||||
Write-Verbose "Running: $command"
|
||||
Invoke-Expression $command
|
||||
if ($lastexitcode -ne 0) {
|
||||
Write-Error "Compressing $source failied"
|
||||
}
|
||||
}
|
||||
|
||||
# If directory contains only one child directory
|
||||
# Flatten it instead
|
||||
function Flatten-Directory ($name) {
|
||||
$child = (Get-Childitem $name)[0]
|
||||
Rename-Item $name -NewName "$($name)_moving"
|
||||
Move-Item -Path "$($name)_moving\$child" -Destination $name
|
||||
Remove-Item -Recurse "$($name)_moving"
|
||||
}
|
||||
|
||||
function Digest-MD5 ($path) {
|
||||
return Invoke-Expression "md5sum $path"
|
||||
}
|
17
vendor/init.bat
vendored
17
vendor/init.bat
vendored
@ -2,6 +2,11 @@
|
||||
:: Sets some nice defaults
|
||||
:: Created as part of cmder project
|
||||
|
||||
:: Find root dir
|
||||
@if not defined CMDER_ROOT (
|
||||
for /f %%i in ("%ConEmuDir%\..\..") do @set CMDER_ROOT=%%~fi
|
||||
)
|
||||
|
||||
:: Change the prompt style
|
||||
:: Mmm tasty lamb
|
||||
@prompt $E[1;32;40m$P$S{git}$S$_$E[1;30;40m{lamb}$S$E[0m
|
||||
@ -24,12 +29,18 @@
|
||||
|
||||
:: Enhance Path
|
||||
@set git_install_root=%CMDER_ROOT%\vendor\msysgit
|
||||
@set PATH=%PATH%;%CMDER_ROOT%\bin;%git_install_root%\bin;%git_install_root%\mingw\bin;%git_install_root%\cmd;%git_install_root%\share\vim\vim73;
|
||||
@set PATH=%CMDER_ROOT%\bin;%git_install_root%\bin;%git_install_root%\mingw\bin;%git_install_root%\cmd;%git_install_root%\share\vim\vim74;%CMDER_ROOT%;%PATH%
|
||||
|
||||
:: Add aliases
|
||||
@doskey /macrofile="%CMDER_ROOT%\config\aliases"
|
||||
|
||||
:: Set home path
|
||||
@set HOME=%USERPROFILE%
|
||||
@if not defined HOME set HOME=%USERPROFILE%
|
||||
|
||||
@if defined CMDER_START cd /d "%CMDER_START%"
|
||||
@if defined CMDER_START (
|
||||
@cd /d "%CMDER_START%"
|
||||
) else (
|
||||
@if "%CD%\" == "%CMDER_ROOT%" (
|
||||
@cd /d "%HOME%"
|
||||
)
|
||||
)
|
||||
|
17
vendor/sources.json
vendored
Normal file
17
vendor/sources.json
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
[
|
||||
{
|
||||
"name": "msysgit",
|
||||
"version": "1.9.4-preview",
|
||||
"url": "https://github.com/msysgit/msysgit/releases/download/Git-1.9.4-preview20140611/PortableGit-1.9.4-preview20140611.7z"
|
||||
},
|
||||
{
|
||||
"name": "clink",
|
||||
"version": "0.4.2",
|
||||
"url": "https://github.com/mridgers/clink/releases/download/0.4.2/clink_0.4.2.zip"
|
||||
},
|
||||
{
|
||||
"name": "conemu-maximus5",
|
||||
"version": "140707",
|
||||
"url": "https://conemu.codeplex.com/downloads/get/880090"
|
||||
}
|
||||
]
|
Reference in New Issue
Block a user