Skip to content

Commit e363139

Browse files
committed
Merge pull request #271 from LeoColomb/master
Add custom loader for Powershell & improve its implementation
2 parents 0e5f070 + 98350e1 commit e363139

File tree

5 files changed

+2277
-11
lines changed

5 files changed

+2277
-11
lines changed

Diff for: .gitignore

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11

22
## Those files should be taken from their repositary
33

4-
vendor/*
5-
!vendor/*.md
6-
!vendor/*.bat
7-
!vendor/*.json
4+
vendor/*/*
5+
!vendor/*
6+
!vendor/psmodules/PsGet
87

98
config/.history
109
Thumbs.db
1110
*.exe
1211
build/
13-
Version v*
12+
Version v*

Diff for: config/ConEmu.xml

+14-6
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@
419419
<value name="KeyMacro03.Text" type="string" data="FontSetSize(1,2)"/>
420420
<value name="KeyMacro04" type="dword" data="000011d1"/>
421421
<value name="KeyMacro04.Text" type="string" data="FontSetSize(1,-2)"/>
422-
<value name="KeyMacro05" type="dword" data="00000000"/>
423-
<value name="KeyMacro05.Text" type="string" data=""/>
422+
<value name="KeyMacro05" type="dword" data="0012a032"/>
423+
<value name="KeyMacro05.Text" type="string" data="Task(&quot;PowerShell as Admin&quot;)"/>
424424
<value name="KeyMacro06" type="dword" data="00000000"/>
425425
<value name="KeyMacro06.Text" type="string" data=""/>
426426
<value name="KeyMacro07" type="dword" data="00000000"/>
@@ -487,21 +487,29 @@
487487
<value name="Count" type="dword" data="00000002"/>
488488
<key name="Task1" modified="2014-01-21 18:36:36" build="131215">
489489
<value name="Name" type="string" data="{cmd}"/>
490-
<value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
490+
<value name="GuiArgs" type="string" data="/icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
491491
<value name="Cmd1" type="string" data="cmd /k &quot;%ConEmuDir%\..\init.bat&quot; -new_console:d:%USERPROFILE%"/>
492492
<value name="Active" type="dword" data="00000000"/>
493493
<value name="Count" type="dword" data="00000001"/>
494494
<value name="Hotkey" type="dword" data="00000000"/>
495495
</key>
496496
<key name="Task2" modified="2014-01-21 18:36:36" build="131215">
497497
<value name="Name" type="string" data="{PowerShell}"/>
498-
<value name="GuiArgs" type="string" data="/dir &quot;%userprofile%&quot;"/>
499-
<value name="Cmd1" type="string" data="powershell"/>
498+
<value name="GuiArgs" type="string" data="/icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
499+
<value name="Cmd1" type="string" data="PowerShell -NoLogo -NoProfile -NoExit -Command &quot;Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''&quot; -new_console:d:&quot;%USERPROFILE%&quot;"/>
500500
<value name="Active" type="dword" data="00000000"/>
501501
<value name="Count" type="dword" data="00000001"/>
502502
<value name="Hotkey" type="dword" data="00000000"/>
503503
</key>
504-
</key>
504+
<key name="Task3" modified="2014-09-17 09:17:41" build="140903">
505+
<value name="Name" type="string" data="{PowerShell as Admin}"/>
506+
<value name="Hotkey" type="dword" data="00000000"/>
507+
<value name="GuiArgs" type="string" data="/icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
508+
<value name="Cmd1" type="string" data="* PowerShell -NoLogo -NoProfile -NoExit -Command &quot;Invoke-Expression '. ''%ConEmuDir%\..\custom.ps1''' &quot; -new_console:d:&quot;%USERPROFILE%&quot;"/>
509+
<value name="Active" type="dword" data="00000000"/>
510+
<value name="Count" type="dword" data="00000001"/>
511+
</key>
512+
</key>
505513
<key name="Apps" modified="2014-01-21 18:36:36" build="131215">
506514
<value name="Count" type="dword" data="00000000"/>
507515
</key>

Diff for: vendor/profile.ps1

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Global modules directory
2+
$global:PsGetDestinationModulePath = $PSScriptRoot + "\..\vendor\psmodules"
3+
4+
# Push to modules location
5+
Push-Location -Path ($PsGetDestinationModulePath)
6+
7+
# Load modules from current directory
8+
Get-ChildItem -Directory | `
9+
Foreach-Object{
10+
Import-Module .\$_\$_
11+
}
12+
13+
# Come back to PWD
14+
Pop-Location
15+
16+
# Set up a Cmder prompt, adding the git prompt parts inside git repos
17+
function global:prompt {
18+
$realLASTEXITCODE = $LASTEXITCODE
19+
$Host.UI.RawUI.ForegroundColor = "white"
20+
Write-Host($pwd.ProviderPath) -NoNewLine -ForegroundColor "green"
21+
if (Get-Module posh-git) {
22+
Write-VcsStatus
23+
}
24+
$global:LASTEXITCODE = $realLASTEXITCODE
25+
return "`nλ "
26+
}
27+
28+
# Load special features come from posh-git
29+
if (Get-Module posh-git) {
30+
Enable-GitColors
31+
Start-SshAgent -Quiet
32+
}
33+
34+
# Move to the wanted location
35+
if (Test-Path Env:\CMDER_START) {
36+
Set-Location -Path $Env:CMDER_START
37+
} elseif ($Env:CMDER_ROOT -and $Env:CMDER_ROOT.StartsWith($pwd)) {
38+
Set-Location -Path $Env:USERPROFILE
39+
}

Diff for: vendor/psmodules/PsGet/PsGet.psd1

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
@{
2+
# These modules will be processed when the module manifest is loaded. This is only supported in PS 3.0
3+
#RootModule = "PsGet.psm1"
4+
5+
#This is required for PS 2.0
6+
ModuleToProcess = "PsGet.psm1"
7+
8+
# The version of this module.
9+
ModuleVersion = '1.0'
10+
11+
# This GUID is used to uniquely identify this module.
12+
GUID = '638FF397-8108-4B94-981A-D9BDAB4774B2'
13+
14+
# The author of this module.
15+
Author = 'Mike Chaliy'
16+
17+
# The company or vendor for this module.
18+
CompanyName = ''
19+
20+
# The copyright statement for this module.
21+
Copyright = '(c) 2013'
22+
23+
# Description of the functionality provided by this module
24+
Description = 'PsGet module for installing PowerShell modules'
25+
26+
# Minimum version of the Windows PowerShell engine required by this module
27+
PowerShellVersion = '2.0'
28+
29+
# Name of the Windows PowerShell host required by this module
30+
# PowerShellHostName = ''
31+
32+
# Minimum version of the Windows PowerShell host required by this module
33+
# PowerShellHostVersion = ''
34+
35+
# Minimum version of the .NET Framework required by this module
36+
DotNetFrameworkVersion = '2.0'
37+
38+
# Minimum version of the common language runtime (CLR) required by this module
39+
CLRVersion = '2.0'
40+
41+
# Processor architecture (None, X86, Amd64) required by this module
42+
ProcessorArchitecture = 'None'
43+
44+
# Modules that must be imported into the global environment prior to importing this module
45+
# RequiredModules = @()
46+
47+
# Assemblies that must be loaded prior to importing this module
48+
# RequiredAssemblies = @()
49+
50+
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
51+
# ScriptsToProcess = @()
52+
53+
# Type files (.ps1xml) to be loaded when importing this module
54+
# TypesToProcess = @()
55+
56+
# Format files (.ps1xml) to be loaded when importing this module
57+
# FormatsToProcess = @()
58+
59+
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
60+
NestedModules = @()
61+
62+
# Functions to export from this module
63+
FunctionsToExport = '*'
64+
65+
# Cmdlets to export from this module
66+
CmdletsToExport = '*'
67+
68+
# Variables to export from this module
69+
VariablesToExport = '*'
70+
71+
# Aliases to export from this module
72+
AliasesToExport = '*'
73+
74+
# List of all modules packaged with this module.
75+
# ModuleList = @()
76+
77+
# List of all files packaged with this module
78+
# FileList = @()
79+
80+
# Private data to pass to the module specified in RootModule/ModuleToProcess
81+
# PrivateData = ''
82+
83+
# HelpInfo URI of this module
84+
# HelpInfoURI = ''
85+
86+
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
87+
# DefaultCommandPrefix = ''
88+
}

0 commit comments

Comments
 (0)