-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement interactive command quit #9
Comments
jfkw
added a commit
to jfkw/uchess
that referenced
this issue
Mar 30, 2023
The quit command is not implemented although it is documented. cmd/uchess does handle Ctrl-C to exit currently. Add a pkg/cmd ProcessCmd() case handler for the command "quit". Add a private function pkg/cmd quit() where additional game state shutdown housekeeping could be processed, e.g. autosave on quit if desired. Currenly the function only returns the msg "quit", mirroring the hint command. Add a cmd/uchess Interact() handler for the msg "quit". On quit, ask for confirmation with Y or y. Exit process on confirm, without saving as is currently documented. Move the internal function Interact().quit() to a public function cmd/uchess Quit() where additional process shutdown housekeeping could be implemented. Currently the function only calls gamestate S.Fini() and os.Exit(0) the process with return code.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Interactive command
quit
is documented in README. However, there is no case handler forquit
inpkg/cmd
func ProcessCmd()
.The interactive tcell loop in
cmd/uchess
func Interact()
handlesCtrl-C
, so there is currently a way to quit the app.When implementing, avoid coupling
pkg/cmd
andcmd/uchess
such that they both handle process quit concerns with overlap. The goal should be forpkg/cmd
to handle game state shutdown, andcmd/uchess
to handle process shutdown.The text was updated successfully, but these errors were encountered: