mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-10 05:17:44 +02:00
Improved the scripts
This commit is contained in:
@ -1,11 +1,13 @@
|
||||
#!/snap/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./configure-git.ps1
|
||||
.DESCRIPTION sets up the Git configuration
|
||||
.SYNTAX ./configure-git.ps1 [<full-name>] [<email-address>] [<favorite-editor>]
|
||||
.DESCRIPTION sets up the Git user configuration
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($FullName = "", $EmailAddress = "", $FavoriteEditor = "")
|
||||
|
||||
try {
|
||||
git --version
|
||||
} catch {
|
||||
@ -13,9 +15,15 @@ try {
|
||||
exit 1
|
||||
}
|
||||
|
||||
$FullName = read-host "Enter your full name"
|
||||
$EmailAddress = read-host "Enter your e-mail address"
|
||||
$FavoriteEditor = read-host "Enter your favorite text editor (emacs,nano,vi,vim,...)"
|
||||
if ($FullName -eq "") {
|
||||
$FullName = read-host "Enter your full name"
|
||||
}
|
||||
if ($EmailAddress -eq "") {
|
||||
$EmailAddress = read-host "Enter your e-mail address"
|
||||
}
|
||||
if ($FavoriteEditor -eq "") {
|
||||
$FavoriteEditor = read-host "Enter your favorite text editor (emacs,nano,vi,vim,...)"
|
||||
}
|
||||
|
||||
try {
|
||||
git config --global user.name $FullName
|
||||
@ -25,7 +33,7 @@ try {
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.symlinks true
|
||||
git config --global init.defaultBranch main
|
||||
write-output "OK - your Git configuration is now:"
|
||||
write-output "OK - your Git user configuration is now:"
|
||||
git config --list
|
||||
exit 0
|
||||
} catch {
|
||||
|
Reference in New Issue
Block a user