Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tuitype"
version = "0.1.5"
version = "0.1.6"
edition = "2021"
description = "A terminal-based typing test application similar to MonkeyType"
authors = ["RobbyV2"]
Expand Down
88 changes: 88 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# TuiType Project Task Runner
# Usage: just <command>
# Run `just --list` to see all available commands

# Default recipe - show available commands
default:
@just --list

# Build the project in debug mode
build:
cargo build

# Build the project in release mode
build-release:
cargo build --release

# Run the application
run *args:
cargo run {{ args }}

# Run tests
test:
cargo test

# Check the project (faster than build, just checks for errors)
check:
cargo check

# Run clippy linter
clippy:
cargo clippy

# Format code with rustfmt
fmt:
cargo fmt

# Check if code is formatted correctly
fmt-check:
cargo fmt -- --check

# Clean build artifacts
clean:
cargo clean

# Auto-fix linting issues where possible
fix:
cargo fix --allow-dirty --allow-staged
cargo clippy --fix --allow-dirty --allow-staged

# Install the binary to ~/.cargo/bin
install:
cargo install --path .

# Run all checks (useful for CI)
ci: fmt-check check clippy test

# Update dependencies
update:
cargo update

# Show cargo tree of dependencies
deps:
cargo tree

# Build for multiple platforms (using the existing build script)
build-multi:
./build_release.sh

# Show project info
info:
@echo "TuiType - Terminal-based typing test application"
@echo "Version: $(grep '^version =' Cargo.toml | cut -d '"' -f 2)"
@echo "Build targets available via build-multi:"
@echo " - Linux x86_64"
@echo " - macOS x86_64"
@echo " - macOS ARM (Apple Silicon)"
@echo " - Windows x86_64"
@echo " - WebAssembly (WASI)"
@echo " - WebAssembly (Web)"

# Development workflow - format, check, test
dev: fmt check test

# Release workflow - all checks plus release build
release: ci build-release

# Quick check - just build and clippy (fastest feedback)
quick: check clippy
4 changes: 2 additions & 2 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ pub fn theme_name(theme_type: ThemeType) -> &'static str {

pub fn test_mode_name(mode: TestMode) -> String {
match mode {
TestMode::Timed(seconds) => format!("{} seconds", seconds),
TestMode::Words(count) => format!("{} words", count),
TestMode::Timed(seconds) => format!("{seconds} seconds"),
TestMode::Words(count) => format!("{count} words"),
TestMode::Quote => "Quote".to_string(),
TestMode::Custom => "Custom".to_string(),
}
Expand Down
11 changes: 1 addition & 10 deletions src/input/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::AppResult;
use crossterm::event::{self, Event as CrosstermEvent, KeyEvent, KeyEventKind, MouseEvent};
use std::collections::HashMap;
use std::env;
use std::time::{Duration, Instant};

#[derive(Debug, Clone, Copy)]
Expand All @@ -13,21 +12,13 @@ pub enum Event {
}

#[derive(Debug, Clone, Copy)]
#[derive(Default)]
struct KeyState {
last_press: Option<Instant>,
last_release: Option<Instant>,
is_held: bool,
}

impl Default for KeyState {
fn default() -> Self {
Self {
last_press: None,
last_release: None,
is_held: false,
}
}
}

impl KeyState {
fn should_process_key(&mut self, now: Instant, kind: KeyEventKind) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn main() -> Result<()> {
execute!(backend, LeaveAlternateScreen, DisableMouseCapture)?;

if let Err(err) = res {
println!("Error: {:?}", err)
println!("Error: {err:?}")
}

Ok(())
Expand Down
Loading
Loading