From eb5edda6220bfb591cbb14bf4330f61f822b0279 Mon Sep 17 00:00:00 2001 From: Marcus Kammer <2262664-marcuskammer@user.noreply.gitlab.com> Date: Mon, 27 Apr 2020 09:47:09 +0200 Subject: [PATCH] Add powershell scripts --- powershell/git.ps1 | 31 +++++++++++++++++++++++++++++++ powershell/prompt.ps1 | 18 ++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 powershell/git.ps1 create mode 100644 powershell/prompt.ps1 diff --git a/powershell/git.ps1 b/powershell/git.ps1 new file mode 100644 index 00000000..b914789d --- /dev/null +++ b/powershell/git.ps1 @@ -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 diff --git a/powershell/prompt.ps1 b/powershell/prompt.ps1 new file mode 100644 index 00000000..c06d4b49 --- /dev/null +++ b/powershell/prompt.ps1 @@ -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 "" +}