I wanted to commit to a git repo without leaving pico 8 so wrote bash script and about 30 tokens to add to the p8 file. Both are here (or at the bottom of the post):
https://gist.github.com/cutecprog/827ef8a82d65a1a27f133fd89392f1b0
Start pico8 by running the bash script. Then to use. First load your p8 file.
> load your_file.p8 > run all text after will be in the commit message no quotes needed commit message set |
Game runs.
Exit the game.
> save |
All p8 files are auto added to repo. This command runs in the terminal
$ git commit -am "commit message set at run" # Runs when a file is saved |
Put in p8 file
-- > run breadcrumb text -- write stat(6) to file to use -- as git commit message -- call in _init() function add_commit_message() -- this saves 1 token local msg = stat(6) -- check if message entered if msg ~= "~~~" and msg ~= "" then -- write message to file printh(msg, "msg", true) -- report success (opt) ?"commit message set" -- sleep for 30 frames (opt) for i=1, 30 do flip() end -- reset breadcrumb run("~~~") end end |
Bash script
#! /bin/bash # Run script to call pico8 ~/pico-8/pico8 & while true; do inotifywait -qq -e CLOSE_WRITE ~/.lexaloffle/pico-8/carts/*.p8 cd ~/.lexaloffle/pico-8/carts git add *.p8 if test -f msg.p8l; then git commit -a -F msg.p8l rm msg.p8l else git commit -am "autocommit" fi done |

1


Interesting idea!
You could even use the -o
option or stdout to communicate from pico8 instead of a file (see serial in official docs).
[Please log in to post a comment]