Skip to content

Instantly share code, notes, and snippets.

@Kambaa
Last active April 29, 2025 14:31
Show Gist options
  • Save Kambaa/db7bfcc3d8ce9f6a35e834479d25ae87 to your computer and use it in GitHub Desktop.
Save Kambaa/db7bfcc3d8ce9f6a35e834479d25ae87 to your computer and use it in GitHub Desktop.
Windows powershell profile (like bashprofile) settings.
Clear-Host
# tab auto completion for git commands
# Install with:  PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force
# more on website: https://github.com/dahlbyk/posh-git?tab=readme-ov-file#installation
Import-Module posh-git
oh-my-posh init pwsh | Invoke-Expression


function QuitReplacement{
Invoke-Command -ScriptBlock {exit}
}

New-Alias -Name q -Value QuitReplacement

$env:J17DIR = "C:\Users\kambaa\.jdks\corretto-17.0.12"
function j17 {
    $env:Path = "$env:J17DIR\bin;$env:Path"
    $env:JAVA_HOME = $env:J17DIR
    java --version
}


function ademo{
Set-Location -Path "C:\temp"
Remove-Item -Path .\* -Recurse -Force
mvn archetype:generate -DarchetypeGroupId='tr.com.mycompany' -DarchetypeArtifactId=my-archetype -DarchetypeVersion='v0.7.2'
$firstFolder = Get-ChildItem -Path "C:\temp" -Directory | Select-Object -First 1
if ($firstFolder ) {
    & 'idea' "$($firstFolder.Name)"
}
}


function gpull {
    git pull origin (git rev-parse --abbrev-ref HEAD)
}

function gpush {
    git push origin (git rev-parse --abbrev-ref HEAD)
}




function mk{
	j17; ./mvnw spotless:apply; ./mvnw checkstyle:check
}

# eğer çalıştırılan dizinde maven wrapper varsa maven wrapper üzerinden
# komut çalıştırılsın, yoksa sistemde yüklü mvn komutu üzerinden devam edilsin.


# eğer çalıştırılan dizinde maven wrapper varsa maven wrapper üzerinden
# komut çalıştırılsın, yoksa sistemde yüklü mvn komutu üzerinden devam edilsin.

function mvnw {
    param (
        [Parameter(ValueFromRemainingArguments = $true)]
        [string[]] $Args
    )

    if (Test-Path "./mvnw") {
        Write-Host "Using wrapper ./mvnw"
        & ./mvnw @Args
    } else {
        Write-Host "Using system mvn"
        & mvn @Args
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment