Powershell Profile (git and visual studio shortcuts)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## include this on your powershell profile | |
function title | |
{ | |
param([string] $title ) | |
$Host.UI.RawUI.WindowTitle = $title | |
} | |
function refreshenv | |
{ | |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") | |
} | |
function sln | |
{ | |
$files = Get-ChildItem *.sln -Recurse | |
if($files.Count -eq 1) | |
{ | |
Start-Process $files[0].FullName | |
} | |
else | |
{ | |
$solutions = "`n More than one solution file found: `n`n" | |
$count = 0; | |
$files | ForEach-Object { | |
$solutions += " $count) " + $_.Name + "`n" | |
$count++; | |
} | |
$solutions += "`n x) to cancel `n" | |
Write-Host $solutions | |
$selection = Read-Host -Prompt ' Which solution would you like to open?' | |
Write-Host "`n" | |
if ($selection -match "^[\d\.]+$" -and ($selection -ge 0 -and $selection -le $files.Length -1)) | |
{ | |
$index = [int]$selection | |
$fileName = $files[$index].FullName | |
Write-Host " Opening $fileName ...`n" | |
Start-Process $fileName | |
} | |
} | |
} | |
function gito | |
{ | |
$url = git config --get remote.origin.url | |
if($url) { | |
$url = $url.replace(".git","").replace("git@github.com:", "https://www.github.com/") | |
Start-Process $url | |
} else { | |
Write-Warning "Nothing returned by 'git config --get remote.origin.url'" | |
} | |
} | |
function gitpr { | |
$url = git config --get remote.origin.url | |
if($url) { | |
$url += "/pullrequest" | |
Start-Process $url | |
} else { | |
Write-Warning "Nothing returned by 'git config --get remote.origin.url'" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment