Created
November 12, 2018 13:38
-
-
Save SecretDeveloper/d787dcd029280007f026c42e1826be79 to your computer and use it in GitHub Desktop.
Starts a pomodoro task, default is 25 minutes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[string]$minutes = 25, # typically pomodoro tasks use 25 minutes or 'work' followed by a short break | |
[string]$taskname = "Task" | |
) | |
$start=$(get-date); | |
$diff=$(get-date)-$start | |
$total=new-object TimeSpan -argumentList 0,$minutes,0 | |
$t=get-date | |
Write-Host("'$taskname' started at $t") | |
while ($diff -lt $total) { | |
write-progress -activity $diff -PercentComplete (($diff.TotalSeconds/$total.TotalSeconds)*100) -Status "Work on '$taskname' for $minutes minutes." | |
sleep 1 | |
$diff=$(get-date)-$start | |
} | |
$t=get-date | |
Write-Host("'$taskname' completed at $t") | |
[console]::beep(2000,900) | |
sleep 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment