Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
galassie committed May 1, 2024
1 parent 53644fa commit 4aa1aa9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,19 @@ let focusBreakCycle =
Func<Task>(fun () ->
task {
while not quit do
skip <- false

do!
AnsiConsole
.Progress()
.StartAsync(fun (ctx) ->
task {
let task1 = ctx.AddTask($"[{focusColor}]Focus[/]")
let task = ctx.AddTask($"[{focusColor}]Focus[/]")

while (not ctx.IsFinished && not quit && not skip) do
do! Task.Delay(1000)
let incrementTime = if pause then 0 else 5
task1.Increment(incrementTime)
task.Increment(incrementTime)

return ()
})
Expand All @@ -104,12 +106,12 @@ let focusBreakCycle =
.Progress()
.StartAsync(fun (ctx) ->
task {
let task1 = ctx.AddTask($"[{breakColor}]Break[/]")
let task = ctx.AddTask($"[{breakColor}]Break[/]")

while (not ctx.IsFinished && not quit && not skip) do
do! Task.Delay(1000)
let incrementTime = if pause then 0 else 5
task1.Increment(incrementTime)
task.Increment(incrementTime)

return ()
})
Expand All @@ -121,6 +123,6 @@ AnsiConsole.MarkupLine("[grey]Press 'p' to pause[/]")
AnsiConsole.MarkupLine("[grey]Press 'r' to resume[/]")
AnsiConsole.MarkupLine("[grey]Press 's' to skip[/]")
AnsiConsole.MarkupLine("[grey]Press 'q' to quit[/]")
Task.WaitAll(focusBreakCycle)
focusBreakCycle.Wait()

AnsiConsole.WriteLine($"Finished!")

0 comments on commit 4aa1aa9

Please sign in to comment.