28 lines
914 B
Bash
Executable File
28 lines
914 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Run beets with the local development config and plugin installed
|
|
# in this project's Poetry-managed virtualenv.
|
|
|
|
PROJECT_ROOT="$(
|
|
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
|
|
pwd
|
|
)"
|
|
CONFIG_FILE="$PROJECT_ROOT/dev-config.yaml"
|
|
|
|
if ! command -v poetry >/dev/null 2>&1; then
|
|
echo "Poetry is required to run this command." >&2
|
|
echo "Install Poetry from https://python-poetry.org/docs/ and run 'poetry install' in this directory." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# So beets only sees config under this project: user config path becomes
|
|
# $PROJECT_ROOT/config.yaml (typically missing), so -c dev-config.yaml is the
|
|
# only config file loaded (plus defaults). Unset so the main ~/.config/beets
|
|
# (or system) config is not merged in.
|
|
export BEETSDIR="$PROJECT_ROOT"
|
|
|
|
# Run beets inside the Poetry virtualenv, pointing at the dev config.
|
|
exec poetry run beet -c "$CONFIG_FILE" "$@"
|
|
|