Made brick, life and blackjack usable in sshd and ansipixels new/open callable more then once#206
Made brick, life and blackjack usable in sshd and ansipixels new/open callable more then once#206
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #206 +/- ##
==========================================
- Coverage 17.31% 17.22% -0.10%
==========================================
Files 23 26 +3
Lines 4308 4332 +24
==========================================
Hits 746 746
- Misses 3531 3555 +24
Partials 31 31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
* Run brick and life with updated sshd hooks in ansipixels * Use current tag from fortio/terminal#206 * New repo name * lint fix and text * A few more logs of what action the user made
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the terminal games (life, brick, and blackjack) to make them usable within SSH server environments by extracting game logic into reusable cli packages. The changes also enhance ansipixels to support pre-configured terminal environments through a new SkipOpen flag and lazy Logger initialization.
Key Changes
- Restructured games by moving main logic to
clisub-packages, allowing game code to be invoked from external contexts like SSH servers - Added
SkipOpenflag and lazy Logger initialization inansipixelsto support pre-opened terminal environments - Made
DetectColorModeEnvfunction public to allow custom environment variable providers
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| life/main.go | New entry point that delegates to cli.Main() |
| life/cli/life.go | Refactored from main package to cli, split into Main() for setup and RunGame() for game loop |
| brick/main.go | New entry point that delegates to cli.Main() |
| brick/cli/brick.go | Refactored from main package to cli, introduces BrickConfig struct and split Main()/Run() pattern |
| brick/cli/replay.go | Changed package from main to cli |
| blackjack/main.go | New entry point containing all setup logic and calling cli.Game.RunGame() |
| blackjack/cli/blackjack.go | Refactored from main package to cli, exposes Game struct with public fields and RunGame() method |
| blackjack/cli/blackjack_test.go | Updated package name and field references from private to public |
| ansipixels/ansipixels.go | Added SkipOpen flag, DetectColorModeEnv function, and moved Logger initialization to Open() with nil check |
Comments suppressed due to low confidence (1)
brick/cli/brick.go:377
- [nitpick] The
FPSfield inBrickConfigis declared but never used. It's not set inMain()and not accessed inRun(). Consider removing it or setting it to*fpsFlaginMain()if it's intended for future use.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
works with
deployed, test at