.PHONY: help clean get upgrade format lint intl build_web docker run_debug_web run_release_web

# Adding a help file: https://gist.github.com/prwhite/8168133#gistcomment-1313022
help: ## This help dialog.
	@IFS=$$'\n' ; \
	help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//'`); \
	for help_line in $${help_lines[@]}; do \
		IFS=$$'#' ; \
		help_split=($$help_line) ; \
		help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
		help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
		printf "%-30s %s\n" $$help_command $$help_info ; \
	done

clean: ## Cleans the environment.
	@echo "• Cleaning the project..."
	@rm -rf pubspec.lock
	@flutter clean

get: ## Gets the dependencies.
	@echo "• Getting the dependencies..."
	@flutter pub get

upgrade: clean ## Upgrades dependencies.
	@echo "• Upgrading dependencies..."
	@flutter pub upgrade

format: ## Formats the code.
	@echo "• Formatting the code"
	@dart format .

lint: ## Lints the code.
	@echo "• Verifying code..."
	@dart analyze . || (echo "Error in project"; exit 1)

intl: get ## Generates the intl files.
	@echo "• Generating the intl files"
	@flutter pub run intl_utils:generate

build_web: clean ## Builds the web application
	@echo "• Building the app"
	@flutter build web

run_debug_web: ## Runs the application in debug mode
	@echo "• Running the app (web:debug)"
	@flutter run




