From cda2987eccfc915502d15a6c84e0e1785419c6c1 Mon Sep 17 00:00:00 2001 From: oedokumaci Date: Mon, 12 Feb 2024 19:16:59 +0300 Subject: [PATCH] ci/cd: add purge-logs recipe to Makefile --- Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 269ef5e..68351e1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help vscode-settings setup update-dev update-user run project-help test pre-commit clean +.PHONY: help vscode-settings setup update-dev update-user run project-help test pre-commit purge-logs clean help: ## Show this help message for each Makefile recipe ifeq ($(OS),Windows_NT) @@ -52,6 +52,18 @@ test: ## Run tests pre-commit: clean ## Run pre-commit pdm run pre-commit run --all-files +purge-logs: ## Prompt user to purge logs that end with .log +ifeq ($(OS),Windows_NT) + @for /r %%i in (logs\*.log) do @echo %%i + @echo "Purge logs? [y/N]" + @set /p choice= + @if /I "$(choice)"=="y" del /q logs\*.log +else + @find logs -name "*.log" -print + @echo "Purge logs? [y/N]" + @read -r choice; if [ "$$choice" = "y" ]; then rm -f logs/*.log; fi +endif + clean: ## Clean cached files ifeq ($(OS),Windows_NT) del /q logs\pytest_test.log || :