set dotenv-load

ctr := "maple"
bin := "bash"

ls:
    just --list

up:
    docker compose -f compose.yaml up --remove-orphans

down:
    docker compose -f compose.yaml down -v --remove-orphans

build:
    docker compose -f compose.yaml build

run:
    docker compose -f compose.yaml run {{ctr}} {{bin}}

exec:
    docker compose -f compose.yaml exec {{ctr}} {{bin}}

dl trg:
    docker compose -f compose.yaml run \
        --remove-orphans \

link plist dir:
    python3 maple-py/link.py {{plist}} {{dir}}

sync args:
    s5cmd {{args}}

usb dst="/Volumes/MAPLE":
    COPYFILE_DISABLE=1 rsync -rtvh --delete --size-only --no-perms --no-owner --no-group --modify-window=2 maple-py/data/usb/Contents/ {{dst}}/Contents/
    COPYFILE_DISABLE=1 rsync -rtvh --delete --size-only --no-perms --no-owner --no-group --modify-window=2 maple-py/data/usb/PIONEER/ {{dst}}/PIONEER/
    # find {{dst}} -name '._*' -delete

usb-reset dst="/Volumes/MAPLE":
    @test -d {{dst}} || (echo "USB not mounted at {{dst}}"; exit 1)
    rm -rf {{dst}}/Contents {{dst}}/PIONEER
    COPYFILE_DISABLE=1 rsync -rtvh --no-perms --no-owner --no-group --modify-window=2 maple-py/data/MAPLE/Contents/ {{dst}}/Contents/
    COPYFILE_DISABLE=1 rsync -rtvh --no-perms --no-owner --no-group --modify-window=2 maple-py/data/MAPLE/PIONEER/ {{dst}}/PIONEER/
    find {{dst}} -name '._*' -delete

maple-setup:
    bash ./etc/maple_setup.sh

maple trg:
    sldl -c ./etc/sldl-macos.yaml {{trg}}
