diff options
author | Indrajith K L | 2022-09-15 00:19:23 +0530 |
---|---|---|
committer | Indrajith K L | 2022-09-15 00:19:23 +0530 |
commit | 0c4bf9cfcba4bf9245bafd9e0891c5939908b178 (patch) | |
tree | ff3f9708b07e77b4061d8d3b2724b9c44815e201 | |
parent | 2325afe99dbec7783bf03a4eedcfa823745541c3 (diff) | |
download | windows-dot-files-0c4bf9cfcba4bf9245bafd9e0891c5939908b178.tar.gz windows-dot-files-0c4bf9cfcba4bf9245bafd9e0891c5939908b178.tar.bz2 windows-dot-files-0c4bf9cfcba4bf9245bafd9e0891c5939908b178.zip |
Updates Powershell Profiles
* Adds Alias for:
* htop
* guid - GUID Generation
* exif - Exif file metadata manipulation
* status - Git Status
* pcb - Git push current Branch
-rw-r--r-- | powershell/user_profile.ps1 | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/powershell/user_profile.ps1 b/powershell/user_profile.ps1 index d0cbd49..9b790e1 100644 --- a/powershell/user_profile.ps1 +++ b/powershell/user_profile.ps1 @@ -1,7 +1,7 @@ #Prompt Import-Module posh-git Import-Module oh-my-posh -Set-PoshPrompt star +Set-PoshPrompt default Import-Module -Name Terminal-Icons # Alias Set-Alias vim nvim @@ -9,7 +9,10 @@ Set-Alias ll ls Set-Alias grep findstr Set-Alias tig 'C:\Program Files\Git\usr\bin\tig.exe' Set-Alias less 'C:\Program Files\Git\usr\bin\less.exe' +Set-Alias htop ntop Set-Alias -Name lv -Value Love2D +Set-Alias guid New-Guid +Set-Alias exif 'C:\tools\exiftool(-k).exe' ## Git Alias Set-Alias g git @@ -18,19 +21,27 @@ Set-Alias -Name branch -Value GitCurrentBranch Set-Alias -Name gg -Value GitGui Set-Alias -Name gbs -Value GitSearchBranch Set-Alias -Name push -Value GitPush +Set-Alias -Name status -Value GitStatus +Set-Alias -Name pcb -Value PushCurrentBranch function GitDiff { $output = (git diff --stat) | Out-String if (!$output) { Write-Output "NONE" - } else { + } + else { Write-Output $output } } function GitCurrentBranch { $output = (git branch) | grep '*' | Out-String - Write-Output $output + $branchName = $output -replace '[*?\{]', '' -replace "\s", "" + Write-Output "`nCurrent Branch is: $branchName `n" + if (($args.Length -gt 0) -and ($args[0] -eq "copy")) { + Set-Clipboard -Value $branchName + Write-Output "Branch Name Copied to Clipboard!`n" + } } function GitGui { @@ -46,10 +57,23 @@ function Love2D { (love . --console) } -function GitPush{ - if(($args.Length -lt 2) -or ($args.Length -gt 2)) { +function GitPush { + if (($args.Length -lt 2) -or ($args.Length -gt 2)) { Write-Output "Usage: push <origin> <branch>" - } else { + } + else { (git push -u $args[0] $args[1]) } } + +function GitStatus { + $output = (git diff --stat) + Write-Output $output +} + +function PushCurrentBranch { + $branchQuery = (git branch) | grep '*' | Out-String + $branchName = $branchQuery -replace '[*?\{]', '' -replace "\s", "" + $originQuery = (git config --get remote.origin.url) + (git push -u $originQuery $branchName) +} |