-
Notifications
You must be signed in to change notification settings - Fork 0
/
Microsoft.PowerShell_profile.ps1
125 lines (92 loc) · 4.78 KB
/
Microsoft.PowerShell_profile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
# Install posh-git
pushd
cd posh-git
Import-Module .\posh-git
popd
. ./configurePrompt.ps1
. ./ssh-agent-utils.ps1
function Start-Explorer{
if(!$args) { explorer . }
else { explorer $args }
}
Set-Alias e Start-Explorer
function Start-Notepad{
& 'C:\Program Files (x86)\Notepad++\notepad++.exe' $args
}
set-alias n Start-Notepad
function Start-gVim {
& 'C:\Program Files (x86)\Vim\vim73\gvim.exe' $args
}
set-alias v Start-gVim
function Set-Location-Dev{
param([string]$location = "")
Push-Location
if($folder -ne ""){
cd $location
return
}
cd $location
}
function elevate-process{
$file, [string]$arguments = $args;
$psi = new-object System.Diagnostics.ProcessStartInfo $file;
$psi.Arguments = $arguments;
$psi.Verb = "runas";
$psi.WorkingDirectory = get-location;
[System.Diagnostics.Process]::Start($psi) >> $null
}
set-alias sudo elevate-process
function Start-VisualStudio{
param([string]$projFile = "")
if($projFile -eq ""){
ls *.sln | select -first 1 | %{
$projFile = $_
}
}
if(($projFile -eq "") -and (Test-Path src)){
ls src\*.sln | select -first 1 | %{
$projFile = $_
}
}
if($projFile -eq ""){
echo "No project file found"
return
}
echo "Starting visual studio with $projFile"
sudo "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe" $projFile
}
set-alias vs Start-VisualStudio
function Start-Project {
Param ($hash)
Set-Location-Dev $hash.Root
cd $hash.Path
Start-VisualStudio $hash.Solution
}
function Service-Path {
Param ($name)
(gwmi win32_service|?{$_.name -like "$name*"}).pathname
}
function CheckStatus {
git status -s
}
set-alias gs CheckStatus
function Clone {
param([string]$repository = "", [string]$folder ="")
git clone $repository
cd $folder
git submodule update --init
}
function CheckoutRemote {
param([string]$branch = "")
git checkout -b $branch --track origin/$branch
}
set-alias gitbranch CheckoutRemote
function NuGetClean {
git status --porcelain | select-string -pattern "\.dll|\.xml" | foreach-object { $_ -replace "\?\? "} | rm
}
set-alias sql ssms.exe
function wcfclient {
& "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\WcfTestClient.exe"
}
. ./environment.ps1