idk fam i just got here what are u a cop
This commit is contained in:
@@ -1,9 +1,23 @@
|
||||
if ($args[0]) { $commit_message=($args -join " ") } # if arg0 exists, join all passed args with spaces
|
||||
else { $commit_message="waypoint" } # or default to "waypoint"
|
||||
# waypoint.ps1
|
||||
|
||||
Write-Host "WAYPOINT!`n`tCommit Message: $commit_message`n"
|
||||
# add and commit
|
||||
if (-not (Test-Path -Path ".\.git" -PathType Container)) {
|
||||
Write-Host "No .git folder detected. Initializing new Git repository..." -ForegroundColor Yellow
|
||||
git init
|
||||
} else {
|
||||
Write-Host "Git repository detected. Creating waypoint..." -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
# Stage all changes
|
||||
git add .
|
||||
git commit -m "$commit_message"
|
||||
|
||||
Write-Host "`nDone :`"3"
|
||||
# Format the timestamp with timezone offset/ID string
|
||||
$timestamp = (Get-Date).ToString("yyyy-MM-dd-HHmm") + "-" + ((Get-TimeZone).Id -creplace '[a-z\s]', '')
|
||||
|
||||
# Capture current git status output
|
||||
$statusOutput = (git status | Out-String).Trim()
|
||||
|
||||
# Construct the commit message
|
||||
$commitMessage = "WAYPOINT $timestamp`n`n$statusOutput"
|
||||
|
||||
# Execute commit
|
||||
git commit -m "$commitMessage"
|
||||
Reference in New Issue
Block a user