Add powershell scripts

This commit is contained in:
Marcus Kammer 2020-04-27 09:47:09 +02:00
parent 4a4d3bfc6c
commit eb5edda622
2 changed files with 49 additions and 0 deletions

31
powershell/git.ps1 Normal file
View file

@ -0,0 +1,31 @@
function Get-GitStatus { & git status -sb $args }
New-Alias -Name gs -Value Get-GitStatus -Force -Option AllScope
function Get-GitCommit { & git commit -ev $args }
New-Alias -Name gc -Value Get-GitCommit -Force -Option AllScope
function Get-GitAdd { & git add --all $args }
New-Alias -Name ga -Value Get-GitAdd -Force -Option AllScope
function Get-GitTree { & git log --graph --oneline --decorate $args }
New-Alias -Name gt -Value Get-GitTree -Force -Option AllScope
function Get-GitPush { & git push $args }
New-Alias -Name gps -Value Get-GitPush -Force -Option AllScope
function Get-GitPull { & git pull $args }
New-Alias -Name gpl -Value Get-GitPull -Force -Option AllScope
function Get-GitFetch { & git fetch $args }
New-Alias -Name gf -Value Get-GitFetch -Force -Option AllScope
function Get-GitCheckout { & git checkout $args }
New-Alias -Name gco -Value Get-GitCheckout -Force -Option AllScope
function Get-GitBranch { & git branch $args }
New-Alias -Name gb -Value Get-GitBranch -Force -Option AllScope
function Get-GitRemote { & git remote -v $args }
New-Alias -Name gr -Value Get-GitRemote -Force -Option AllScope
# vim:ft=ps1

18
powershell/prompt.ps1 Normal file
View file

@ -0,0 +1,18 @@
function prompt {
$prompt_str = ""
# GIT branch
$git_prompt = git branch | foreach { if ($_ -match "^\*(.*)"){ $matches[1] } }
$prompt_str += "$git_prompt || "
# Python
$py_prompt = python --version
$prompt_str += "$py_prompt || "
# short path
$p = Split-Path -leaf -path (Get-Location)
$prompt_str += "$p"
Write-Host ($prompt_str)
return ""
}