Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param (
- [Parameter(Mandatory=$false)]
- [string]$username,
- [Parameter(Mandatory=$false)]
- [string]$email,
- [Parameter(Mandatory=$false)]
- [string]$profile
- )
- [string]$GIT_CONFIG_FILE_PATH = '.gitconfig';
- [string]$GIT_CONFIG_FILE_TEMPLATE =
- '[user]
- name = {0}
- email = {1}
- [credential]
- helper = manager
- [diff]
- tool = vimdiff
- [difftool]
- prompt = false
- [alias]
- d = difftool';
- [string[]]$profiles = 'work', 'home';
- [string]$output = '';
- if(![string]::IsNullOrEmpty($profile))
- {
- switch ($profile)
- {
- 'work' { $output = $GIT_CONFIG_FILE_TEMPLATE -f 'Petromil Pavlov', 'petromil.pavlov@softwaregroup.com' }
- 'home' { $output = $GIT_CONFIG_FILE_TEMPLATE -f 'Dominent', 'petromilpavlov@gmail.com' }
- default { Write-Error "Unknown Profile!: $profile"}
- }
- }
- [System.Text.UTF8Encoding]$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
- [string]$outputFilePath = [System.IO.Path]::Combine($env:HOMEPATH, $GIT_CONFIG_FILE_PATH);
- [System.IO.File]::WriteAllText($outputFilePath, $output, $Utf8NoBomEncoding)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement