Skip to content

Commit

Permalink
ci/cd: add purge-logs recipe to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
oedokumaci committed Feb 12, 2024
1 parent 20fc2ee commit cda2987
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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 || :
Expand Down

0 comments on commit cda2987

Please sign in to comment.