diff options
| author | mo8it <mo8it@proton.me> | 2024-10-13 23:28:17 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-10-13 23:28:17 +0200 |
| commit | 396ee4d618bc5e1cd5c84495f571f9d3f79774c8 (patch) | |
| tree | fab43fd8abdcc3577e17a052c9c96538dd0b9b26 /src/main.rs | |
| parent | 326169a7fabacda9a21377b110371f91b32e8fd3 (diff) | |
Show progress with exercise numbers
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/main.rs b/src/main.rs index f40bb89..075e726 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,6 @@ use anyhow::{bail, Context, Result}; use app_state::StateFileStatus; use clap::{Parser, Subcommand}; -use crossterm::{ - style::{Color, Print, ResetColor, SetForegroundColor}, - QueueableCommand, -}; use std::{ io::{self, IsTerminal, Write}, path::Path, @@ -157,12 +153,13 @@ fn main() -> Result<ExitCode> { let pending = app_state.n_pending(); if pending == 1 { - stdout.queue(Print("One exercise pending: "))?; + stdout.write_all(b"One exercise pending: ")?; } else { - stdout.queue(SetForegroundColor(Color::Red))?; - write!(stdout, "{pending}")?; - stdout.queue(ResetColor)?; - stdout.queue(Print(" exercises are pending. The first: "))?; + write!( + stdout, + "{pending}/{} exercises are pending. The first: ", + app_state.exercises().len(), + )?; } app_state .current_exercise() |
