73 lines
2.1 KiB
Makefile
Raw Normal View History

# Usage:
# just clean # prompts before each step
# just clean -y # skips all prompts
# just clean --yes # skips all prompts
clean *args:
#!/usr/bin/env bash
skip_confirmation=0
case "{{args}}" in
*-y*|*--yes*) skip_confirmation=1 ;;
esac
confirm() {
[ "$skip_confirmation" = "1" ] && return 0
read -r -n 1 -p "$1 [y/N] " ans
echo
case "$ans" in
[yY]) return 0 ;;
*) return 1 ;;
esac
}
remove() {
if [ -e "$1" ]; then
confirm "Remove $1?" && { echo "Removing $1"; rm -rf "$1"; }
else
echo "Already removed: $1"
fi
}
logos_procs="$(pgrep -ax logos_host_qt || true)"
if [ -n "$logos_procs" ]; then
echo "Found matching processes:"
echo "$logos_procs"
echo "This will kill the process(es) above."
confirm "Proceed?" && { pkill -x logos_host_qt; echo "Killed."; }
else
echo "Already killed"
fi
remove state
shopt -s nullglob
timestamp_files=( [0-9]* )
shopt -u nullglob
if [ ${#timestamp_files[@]} -gt 0 ]; then
confirm "Remove ${timestamp_files[*]}?" && { echo "Removing ${timestamp_files[*]}"; rm -rf "${timestamp_files[@]}"; }
else
echo "Already removed: [0-9]* (no matching files)"
fi
remove keystore.yaml
remove user_config.yaml
run: (clean "-y")
nix run
# Launch CLion inside the Nix dev shell so it inherits required variables and fully integrates with Nix.
clion:
nix develop -c "$HOME/.local/share/JetBrains/Toolbox/apps/clion/bin/clion.sh" . >/dev/null 2>&1 &
prettify:
nix shell nixpkgs#clang-tools -c clang-format -i src/**.cpp src/**.h
# Reuses cmake-build-debug's compile_commands.json (generated by CLion) instead
# of a `configure` step — this repo has no standalone `build` recipe.
lint:
nix shell nixpkgs#clang-tools --command clang-tidy \
-p cmake-build-debug \
--header-filter='src/.*' \
--extra-arg-before=--driver-mode=g++ \
src/BlockchainPlugin.cpp src/BlockchainBackend.cpp src/AccountsModel.cpp src/LogModel.cpp