Skip to content

Commit 049dfac

Browse files
committed
feat: Streamline release workflow process and UI improvements
1 parent 903cbba commit 049dfac

File tree

6 files changed

+231
-110
lines changed

6 files changed

+231
-110
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Go Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
issues: write
12+
13+
jobs:
14+
goreleaser:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: "1.24.1"
26+
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@v5
29+
with:
30+
distribution: goreleaser
31+
version: latest
32+
args: release --clean
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
project_name: go-typer
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- darwin
13+
- windows
14+
goarch:
15+
- amd64
16+
- arm64
17+
- "386"
18+
main: ./main.go
19+
binary: "go-typer-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
20+
ldflags:
21+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
22+
ignore:
23+
- goos: darwin
24+
goarch: "386"
25+
26+
archives:
27+
- format: tar.gz
28+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
29+
format_overrides:
30+
- goos: windows
31+
format: zip
32+
files:
33+
- LICENSE
34+
- README.md
35+
36+
nfpms:
37+
- vendor: "go-typer"
38+
homepage: "https://github.com/prime-run/go-typer"
39+
maintainer: "prime-run"
40+
description: "go-typer: A typing game in terminal built in go"
41+
license: "MIT"
42+
formats:
43+
- deb
44+
- rpm
45+
bindir: /usr/bin
46+
47+
checksum:
48+
name_template: "checksums.txt"
49+
50+
snapshot:
51+
name_template: "{{ incpatch .Version }}-next"
52+
53+
changelog:
54+
sort: asc
55+
filters:
56+
exclude:
57+
- "^docs:"
58+
- "^test:"
59+
- "^ci:"
60+
- "^chore:"
61+
62+
release:
63+
github:
64+
owner: prime-run
65+
name: go-typer
66+
prerelease: auto
67+
draft: false

README.md

Lines changed: 108 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,146 @@
1-
# Go Typer
21

3-
A terminal-based typing game written in Go with bubbletea and lipgloss.
2+
# 🚀 Go Typer
43

5-
## Features
4+
**The sleek, blazing-fast terminal typing test inspired by [MonkeyType](https://monkeytype.com/)!**
65

7-
- Terminal UI typing game with colorful interface
8-
- Real-time WPM calculation
9-
- Support for different cursor styles
10-
- Customizable themes
11-
- Efficient and lightweight
6+
Go Typer brings the popular web-based typing experience of MonkeyType to your terminal with a beautiful, customizable interface. Master your typing skills right in your command line without the distractions of a browser.
127

13-
## Screenshots
148

15-
![Screenshot](https://github.com/user-attachments/assets/5ac1ed81-da75-4222-8bcd-83b96497cb37)
169

17-
## Requirements
10+
https://github.com/user-attachments/assets/b0667bb5-9572-4738-81f9-553977195319
1811

19-
The app has been tested on linux,but should run on major platforms as long as they support "TrueColor".
2012

21-
You can check if your terminal emulator supports 24-bit color by running:
13+
14+
15+
![250405_12h57m34s_screenshot](https://github.com/user-attachments/assets/309aac27-5c1e-4468-947d-123e0b33efe0)
16+
![250405_12h57m45s_screenshot](https://github.com/user-attachments/assets/ebebc4d5-b895-48fb-81dd-3b920b5825bd)
17+
![250405_12h58m44s_screenshot](https://github.com/user-attachments/assets/16c52833-0e4e-432e-b7e2-5dc04a60bec2)
18+
19+
## ✨ Features
20+
21+
- **⚡ MonkeyType-Style Gameplay**: Space bar to advance between words, just like the web favorite!
22+
- **📊 Real-time WPM & Accuracy Tracking**: Watch your stats update live as you type
23+
- **🎮 Multiple Game Modes**: Choose between normal mode (with punctuation) or simple mode for beginners
24+
- **🎨 Gorgeous Themes**: Customize your experience with beautiful color schemes
25+
- **📏 Flexible Text Lengths**: Practice with short, medium, long, or very long passages
26+
- **⚙️ Performance Tuning**: Adjust refresh rates from 5-60 FPS for any hardware
27+
- **🌈 Stunning Gradient Animations**: Eye-catching color flows throughout the interface
28+
- **📝 Cursor Options**: Choose your preferred cursor style (block or underline)
29+
- **💻 100% Terminal-Based**: No browser needed - perfect for developers and terminal enthusiasts
30+
31+
## 🖥️ Terminal Requirements
32+
33+
Go Typer works best in terminals that support "TrueColor" (24-bit color). It's been tested extensively on Linux but runs great on macOS and Windows too!
34+
35+
Verify your terminal supports TrueColor by running:
2236

2337
```bash
2438
printf "\x1b[38;2;255;0;0mTRUECOLOR\x1b[0m\n"
2539
```
2640

27-
If your terminal **emulator does NOT display the word** `TRUECOLOR` in **red**, it does not support 24-bit color, checkout [this gist](https://gist.github.com/weimeng23/60b51b30eb758bd7a2a648436da1e562).
41+
If you see "TRUECOLOR" in red, you're good to go! If not, check out [this compatibility guide](https://gist.github.com/weimeng23/60b51b30eb758bd7a2a648436da1e562).
2842

29-
## Installation
43+
## 🚀 Installation
3044

31-
```
45+
### Download Binaries (Quickest Start)
46+
47+
Grab pre-built binaries from the [Releases](https://github.com/prime-run/go-typer/releases) page for instant typing pleasure!
48+
49+
### Go Install (For Go Users)
50+
51+
```bash
3252
go install github.com/prime-run/go-typer@latest
3353
```
3454

35-
Or clone the repository and build:
55+
### Clone and Build (From Source)
3656

37-
```
57+
```bash
3858
git clone https://github.com/prime-run/go-typer.git
3959
cd go-typer
40-
go build
60+
go build -o bin/go-typer
61+
./bin/go-typer
4162
```
4263

43-
## Used in this project
64+
### Make (Unix/Linux)
4465

45-
[![Go](https://img.shields.io/badge/Go-00ADD8?style=flat-square&logo=go&logoColor=white)](https://go.dev/) [![Cobra](https://img.shields.io/badge/Cobra-00ADD8?style=flat-square&logo=go&logoColor=white)](https://github.com/spf13/cobra) [![Bubble Tea](https://img.shields.io/badge/Bubble%20Tea-FF75B7?style=flat-square&logo=go&logoColor=white)](https://github.com/charmbracelet/bubbletea) [![Lip Gloss](https://img.shields.io/badge/Lip%20Gloss-FFABE7?style=flat-square&logo=go&logoColor=white)](https://github.com/charmbracelet/lipgloss)
66+
```bash
67+
git clone https://github.com/prime-run/go-typer.git
68+
cd go-typer
69+
make build
70+
./bin/go-typer
71+
```
4672

47-
## Usage
73+
### Docker (Container)
4874

49-
Start the typing game:
75+
```bash
76+
# Pull from Docker Hub
77+
docker pull primerun/go-typer:latest
5078

51-
```
52-
go-typer start
79+
# Run in container
80+
docker run -it --rm primerun/go-typer:latest
81+
82+
# Build locally
83+
git clone https://github.com/prime-run/go-typer.git
84+
cd go-typer
85+
docker build -t go-typer .
86+
docker run -it --rm go-typer
5387
```
5488

55-
### Options
89+
## 🛠️ Built With
5690

57-
- `-c, --cursor <type>`: Choose cursor type (block or underline)
58-
- `-t, --theme <name>`: Choose a theme or path to custom theme file
59-
- `--list-themes`: List all available themes
91+
[![Go](https://img.shields.io/badge/Go-00ADD8?style=flat-square&logo=go&logoColor=white)](https://go.dev/) [![Cobra](https://img.shields.io/badge/Cobra-00ADD8?style=flat-square&logo=go&logoColor=white)](https://github.com/spf13/cobra) [![Bubble Tea](https://img.shields.io/badge/Bubble%20Tea-FF75B7?style=flat-square&logo=go&logoColor=white)](https://github.com/charmbracelet/bubbletea) [![Lip Gloss](https://img.shields.io/badge/Lip%20Gloss-FFABE7?style=flat-square&logo=go&logoColor=white)](https://github.com/charmbracelet/lipgloss)
6092

61-
Examples:
93+
## 🎮 How to Play
6294

63-
```
64-
# Start with underline cursor
65-
go-typer start -c underline
95+
1. Launch Go Typer:
96+
```bash
97+
go-typer
98+
```
6699

67-
# Use dark theme
68-
go-typer start -t dark
100+
2. **Navigate** through the menu to start typing
101+
3. **Type** the text as displayed - it's colored to show you what's correct and incorrect
102+
4. Press **spacebar** to advance to the next word (just like on MonkeyType!)
103+
5. Your **WPM**, **accuracy**, and timing are tracked in real-time
104+
6. Complete the passage to see your final stats
69105

70-
# Use a custom theme file
71-
go-typer start -t /path/to/custom/theme.yml
106+
### 🎯 Keyboard Controls
72107

73-
# List available themes
74-
go-typer start --list-themes
75-
```
108+
- **↑/↓ or j/k**: Navigate through menu items
109+
- **Enter**: Select menu item
110+
- **Esc**: Go back to previous screen
111+
- **Space**: Advance to the next word while typing
112+
- **Tab**: Restart current typing exercise
113+
- **q or Ctrl+C**: Quit the application
76114

77-
## Themes
115+
## ⚙️ Configuration
78116

79-
Go Typer supports customizable themes via YAML files in the `colorschemes` directory.
117+
Go-Typer automatically saves your preferences in your user config directory:
118+
- Linux/BSD: `~/.config/go-typer/settings.json`
119+
- macOS: `~/Library/Application Support/go-typer/settings.json`
120+
- Windows: `%AppData%\go-typer\settings.json`
80121

81-
Built-in themes:
122+
### 🔧 Customize Your Experience
123+
124+
- **Theme**: Pick from eye-catching color schemes
125+
- **Cursor Style**: Block or underline, based on your preference
126+
- **Game Mode**: Normal mode (with punctuation) or Simple mode for beginners
127+
- **Numbers**: Toggle inclusion of numbers in typing tests
128+
- **Text Length**: Choose from Short (1 quote), Medium (2 quotes), Long (3 quotes), or Very Long (5 quotes)
129+
- **Refresh Rate**: Fine-tune animation smoothness from 5 FPS (battery-saving) to 60 FPS (ultra-smooth)
130+
131+
## 🎨 Themes
132+
133+
Go Typer includes beautiful themes inspired by popular coding and typing interfaces.
82134

83-
- `default`: Standard light theme with green/blue colors
84-
- `dark`: Dark theme with purple/blue accents
85-
- `monochrome`: Minimalist black and white theme
135+
Built-in themes:
86136

87-
### Creating Custom Themes
137+
- `default`: Clean light theme with green/blue highlights
138+
- `dark`: Sleek dark theme with purple/blue accents
139+
- `monochrome`: Minimalist black and white theme for distraction-free typing
88140

89-
You can create your own themes by adding a new YAML file to the `colorschemes` directory or by specifying a custom path with the `-t` flag.
141+
### 🖌️ Create Your Own Theme
90142

91-
Theme files use the following structure:
143+
Customize your typing experience by creating a theme file:
92144

93145
```yaml
94146
# UI Elements
@@ -112,24 +164,18 @@ cursor_underline: "#00AAFF" # Underline cursor color
112164
padding: "#888888" # Padding elements color
113165
```
114166
115-
## Usage and playing
116-
117-
```bash
118-
./go-typer --help
119-
```
167+
## 🔄 Related Projects
120168
121-
### Related
169+
**togo**: A terminal-based todo manager built with the same technology stack!
170+
[Check out togo on GitHub](https://github.com/prime-run/togo)
122171
123-
togo: a terminal-based todo manager built with same tech!
124-
[togo](https://github.com/prime-run/togo)
172+
## 🤝 Contributing
125173
126-
## Contributing
174+
Love Go Typer? Contributions are always welcome!
127175
128-
Contributions are always welcome!
176+
- Check out our [todos](todos.md) for upcoming features
129177
130-
- Please checkout [todos](todos.md) for next steps.
131-
- Features in `dev` branch haven't been tested for different shells and terminal emulators.
132178
133-
## License
179+
## 📜 License
134180
135181
[MIT](LICENSE)

test_game

-5.57 MB
Binary file not shown.

ui/loading.go

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -75,52 +75,25 @@ func (m *LoadingModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
7575
func (m *LoadingModel) View() string {
7676
spinnerStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("#00ADD8"))
7777

78-
pad := strings.Repeat(" ", 25)
79-
8078
progressBar := m.progressBar.ViewAs(m.progress)
81-
8279
spinnerDisplay := spinnerStyle.Render(m.spinner.View())
8380

84-
content := lipgloss.NewStyle().
85-
Width(m.width * 3 / 4).
86-
Align(lipgloss.Center).
87-
Render(
88-
"\n\n" +
89-
pad + spinnerDisplay + "\n\n" +
90-
pad + "Loading text..." + "\n\n" +
91-
pad + progressBar + "\n\n" +
92-
pad + HelpStyle("Fetching text from server..."))
81+
centeredSpinner := lipgloss.NewStyle().Width(m.width * 3 / 4).Align(lipgloss.Center).Render(spinnerDisplay)
82+
centeredLoadingText := lipgloss.NewStyle().Width(m.width * 3 / 4).Align(lipgloss.Center).Render("Loading text...")
83+
centeredProgressBar := lipgloss.NewStyle().Width(m.width * 3 / 4).Align(lipgloss.Center).Render(progressBar)
84+
centeredHelp := lipgloss.NewStyle().Width(m.width * 3 / 4).Align(lipgloss.Center).Render(HelpStyle("Fetching random text from https://zenquotes.io/api/random ..."))
85+
86+
content := "\n\n" +
87+
centeredSpinner + "\n\n" +
88+
centeredLoadingText + "\n\n" +
89+
centeredProgressBar + "\n\n" +
90+
centeredHelp
9391

9492
return lipgloss.Place(m.width, m.height,
9593
lipgloss.Center, lipgloss.Center,
9694
content)
9795
}
9896

99-
func renderProgressBar(progress float64, width int) string {
100-
if progress < 0 {
101-
progress = 0
102-
} else if progress > 1 {
103-
progress = 1
104-
}
105-
106-
filled := int(progress * float64(width))
107-
if filled > width {
108-
filled = width
109-
}
110-
111-
bar := "["
112-
for i := 0; i < width; i++ {
113-
if i < filled {
114-
bar += "="
115-
} else {
116-
bar += " "
117-
}
118-
}
119-
bar += "]"
120-
121-
return bar
122-
}
123-
12497
func fetchTextCmd() tea.Cmd {
12598
return func() tea.Msg {
12699
textCount := map[string]int{

0 commit comments

Comments
 (0)