Skip to content

added tui#6

Open
Irvinwop wants to merge 2 commits into
Aztro-dev:mainfrom
Irvinwop:main
Open

added tui#6
Irvinwop wants to merge 2 commits into
Aztro-dev:mainfrom
Irvinwop:main

Conversation

@Irvinwop

Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings March 26, 2026 00:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an interactive terminal UI (TUI) and a shared progress/cancellation mechanism so scraping runs can be monitored and cancelled, while also refactoring CLI execution to produce structured output suitable for both TUI and plain CLI printing.

Changes:

  • Introduce progress module (installable global snapshot, step accounting, cancellation flag) and thread-safe recording from scrape/request paths.
  • Add interactive TUI that builds CLI options, runs scrapes on a worker thread, displays live progress, supports cancellation, and renders results with filtering/search.
  • Refactor main/overall output paths (e.g., highscores_data, section formatting) and tighten some parsing/cancellation checks.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/scrape.rs Integrates progress step totals, per-attempt recording, and cancellation checks into parallel scraping.
src/request.rs Adds cancellation short-circuits and improves comma-separated conference parsing.
src/progress.rs New shared progress snapshot + cancellation flag with install guard and update helpers.
src/overall.rs Threads cancellation checks through long loops; refactors highscores into data-returning function.
src/main.rs Adds structured RunOutput/sections, routes to TUI when no args, refactors CLI execution and formatting helpers.
src/interactive.rs New crossterm-based TUI for configuring runs, showing live progress, cancellation, and browsing results.
src/cli.rs Makes CLI structs cloneable/debuggable and updates option docs to match new defaults behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/interactive.rs
}
},
Err(mpsc::TryRecvError::Disconnected) => {
return Err(io::Error::other("Scrape thread disconnected unexpectedly."))

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This match arm is missing a trailing semicolon after the return Err(...) statement, which will cause a compile error. Add the semicolon (and consider fixing indentation for readability).

Suggested change
return Err(io::Error::other("Scrape thread disconnected unexpectedly."))
return Err(io::Error::other(
"Scrape thread disconnected unexpectedly.",
));

Copilot uses AI. Check for mistakes.
Comment thread src/interactive.rs
Comment on lines +9 to +24
use crossterm::{
cursor,
event::{
self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyEvent, KeyModifiers,
MouseButton, MouseEvent, MouseEventKind,
},
execute, queue,
style::{
Attribute, Color, Print, ResetColor, SetAttribute, SetBackgroundColor,
SetForegroundColor,
},
terminal::{
self, Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode,
enable_raw_mode,
},
};

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crossterm is used here, but it is not listed in Cargo.toml dependencies in this PR's current state, so the crate will fail to compile with an unresolved import. Add crossterm (and any required features) to Cargo.toml to match these imports.

Copilot uses AI. Check for mistakes.
Comment thread src/main.rs
Comment on lines +528 to +534
format!(
"{:>3}. {:<name_width$} {:>score_width$} [{}A] {}",
index + 1,
item.school,
item.score,
item.conference,
item.school,

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format_highscore_team_lines prints item.school twice (once as the name column and again at the end), which makes the output redundant/incorrect. Adjust the formatting so the trailing field is the intended secondary value (e.g., year only, or remove the duplicate entirely).

Suggested change
format!(
"{:>3}. {:<name_width$} {:>score_width$} [{}A] {}",
index + 1,
item.school,
item.score,
item.conference,
item.school,
let year = item.school.get(0..4).unwrap_or("");
format!(
"{:>3}. {:<name_width$} {:>score_width$} [{}A] {}",
index + 1,
item.school,
item.score,
item.conference,
year,

Copilot uses AI. Check for mistakes.
Comment thread src/overall.rs
Comment on lines +77 to +79
if progress::is_cancelled() {
break;
}

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two identical progress::is_cancelled() checks back-to-back, which is redundant and makes the loop harder to read. Remove the duplicate check (keep just one).

Suggested change
if progress::is_cancelled() {
break;
}

Copilot uses AI. Check for mistakes.
Comment thread src/overall.rs
Comment on lines +583 to +587
let base: ColoredString = format!(
"{:longest_name_len$} => {:>score_len$} ({conference_str} {})",
school_name,
team.score,
team.school,

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This output format uses school_name for the left column but prints team.school as the trailing value, which typically contains the school name again (and possibly the year prefix). This results in duplicated school text in the rendered line; consider printing just the year portion (as before) or removing the trailing school field.

Suggested change
let base: ColoredString = format!(
"{:longest_name_len$} => {:>score_len$} ({conference_str} {})",
school_name,
team.score,
team.school,
let school_year = if team.school.len() >= 4 { &team.school[0..4] } else { &team.school };
let base: ColoredString = format!(
"{:longest_name_len$} => {:>score_len$} ({conference_str} {})",
school_name,
team.score,
school_year,

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants