mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-04 20:05:51 +00:00
I started with really simple pre-commit hooks and will add more on top. Important files: - `.pre-commit-config.yaml` - the config for pre-commit - `.github/workflows/pre-commit.yml` - runs pre-commit hooks in branches and `develop` - `.github/workflows/pre-commit-autoupdate.yml` - autoupdates pre-commit hooks once in a month
62 lines
1.0 KiB
Bash
Executable File
62 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
script_dir=$(dirname $0)
|
|
|
|
pushd $script_dir > /dev/null
|
|
|
|
function start_container {
|
|
if [ -z "$(docker ps -q -f name=clio_develop)" ]; then
|
|
docker compose up -d
|
|
fi
|
|
}
|
|
|
|
function run {
|
|
start_container
|
|
docker compose exec clio_develop "$@"
|
|
}
|
|
|
|
function stop_container {
|
|
docker compose down
|
|
}
|
|
|
|
function open_terminal {
|
|
start_container
|
|
docker compose exec clio_develop /bin/bash
|
|
}
|
|
|
|
function print_help {
|
|
cat <<EOF
|
|
run: Run a command inside the development container.
|
|
|
|
Usage:
|
|
run [options or command]
|
|
|
|
If no options are provided, the command will be executed inside the container.
|
|
|
|
Options:
|
|
-h, --help Show this help message and exit.
|
|
-t, --terminal Open a terminal inside the container.
|
|
-s, --stop Stop the container.
|
|
EOF
|
|
}
|
|
|
|
case $1 in
|
|
-h|--help)
|
|
print_help ;;
|
|
|
|
-t|--terminal)
|
|
open_terminal ;;
|
|
|
|
-s|--stop)
|
|
stop_container ;;
|
|
|
|
-*)
|
|
echo "Unknown option: $1"
|
|
print_help ;;
|
|
|
|
*)
|
|
run "$@" ;;
|
|
esac
|
|
|
|
popd > /dev/null
|