mirror of
https://github.com/rr-/pq-cli.git
synced 2026-09-28 22:33:59 -06:00
initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import pickle
|
||||
from pathlib import Path
|
||||
|
||||
import xdg
|
||||
|
||||
from pqcli.game_state import Roster
|
||||
from pqcli.ui import Ui
|
||||
|
||||
|
||||
SAVE_PATH = Path(xdg.XDG_CONFIG_HOME) / "pqcli" / "save.dat"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
if SAVE_PATH.exists():
|
||||
roster = pickle.loads(SAVE_PATH.read_bytes())
|
||||
else:
|
||||
roster = Roster()
|
||||
|
||||
try:
|
||||
Ui(roster).run()
|
||||
finally:
|
||||
SAVE_PATH.parent.mkdir(parents=True, exist_ok=True)
|
||||
SAVE_PATH.write_bytes(pickle.dumps(roster))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user