Skip to content

Commit 31cc24e

Browse files
authored
Merge pull request #2 from RobbyV2/copilot/fix-1
Add justfile with useful commands and bump version to 0.1.6
2 parents d0462cd + 46e3461 commit 31cc24e

File tree

9 files changed

+157
-95
lines changed

9 files changed

+157
-95
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tuitype"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
edition = "2021"
55
description = "A terminal-based typing test application similar to MonkeyType"
66
authors = ["RobbyV2"]

justfile

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# TuiType Project Task Runner
2+
# Usage: just <command>
3+
# Run `just --list` to see all available commands
4+
5+
# Default recipe - show available commands
6+
default:
7+
@just --list
8+
9+
# Build the project in debug mode
10+
build:
11+
cargo build
12+
13+
# Build the project in release mode
14+
build-release:
15+
cargo build --release
16+
17+
# Run the application
18+
run *args:
19+
cargo run {{ args }}
20+
21+
# Run tests
22+
test:
23+
cargo test
24+
25+
# Check the project (faster than build, just checks for errors)
26+
check:
27+
cargo check
28+
29+
# Run clippy linter
30+
clippy:
31+
cargo clippy
32+
33+
# Format code with rustfmt
34+
fmt:
35+
cargo fmt
36+
37+
# Check if code is formatted correctly
38+
fmt-check:
39+
cargo fmt -- --check
40+
41+
# Clean build artifacts
42+
clean:
43+
cargo clean
44+
45+
# Auto-fix linting issues where possible
46+
fix:
47+
cargo fix --allow-dirty --allow-staged
48+
cargo clippy --fix --allow-dirty --allow-staged
49+
50+
# Install the binary to ~/.cargo/bin
51+
install:
52+
cargo install --path .
53+
54+
# Run all checks (useful for CI)
55+
ci: fmt-check check clippy test
56+
57+
# Update dependencies
58+
update:
59+
cargo update
60+
61+
# Show cargo tree of dependencies
62+
deps:
63+
cargo tree
64+
65+
# Build for multiple platforms (using the existing build script)
66+
build-multi:
67+
./build_release.sh
68+
69+
# Show project info
70+
info:
71+
@echo "TuiType - Terminal-based typing test application"
72+
@echo "Version: $(grep '^version =' Cargo.toml | cut -d '"' -f 2)"
73+
@echo "Build targets available via build-multi:"
74+
@echo " - Linux x86_64"
75+
@echo " - macOS x86_64"
76+
@echo " - macOS ARM (Apple Silicon)"
77+
@echo " - Windows x86_64"
78+
@echo " - WebAssembly (WASI)"
79+
@echo " - WebAssembly (Web)"
80+
81+
# Development workflow - format, check, test
82+
dev: fmt check test
83+
84+
# Release workflow - all checks plus release build
85+
release: ci build-release
86+
87+
# Quick check - just build and clippy (fastest feedback)
88+
quick: check clippy

src/config/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ pub fn theme_name(theme_type: ThemeType) -> &'static str {
130130

131131
pub fn test_mode_name(mode: TestMode) -> String {
132132
match mode {
133-
TestMode::Timed(seconds) => format!("{} seconds", seconds),
134-
TestMode::Words(count) => format!("{} words", count),
133+
TestMode::Timed(seconds) => format!("{seconds} seconds"),
134+
TestMode::Words(count) => format!("{count} words"),
135135
TestMode::Quote => "Quote".to_string(),
136136
TestMode::Custom => "Custom".to_string(),
137137
}

src/input/mod.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,13 @@ pub enum Event {
1313
}
1414

1515
#[derive(Debug, Clone, Copy)]
16+
#[derive(Default)]
1617
struct KeyState {
1718
last_press: Option<Instant>,
1819
last_release: Option<Instant>,
1920
is_held: bool,
2021
}
2122

22-
impl Default for KeyState {
23-
fn default() -> Self {
24-
Self {
25-
last_press: None,
26-
last_release: None,
27-
is_held: false,
28-
}
29-
}
30-
}
3123

3224
impl KeyState {
3325
fn should_process_key(&mut self, now: Instant, kind: KeyEventKind) -> bool {

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn main() -> Result<()> {
3636
execute!(backend, LeaveAlternateScreen, DisableMouseCapture)?;
3737

3838
if let Err(err) = res {
39-
println!("Error: {:?}", err)
39+
println!("Error: {err:?}")
4040
}
4141

4242
Ok(())

0 commit comments

Comments
 (0)