diff --git a/CHANGELOG.md b/CHANGELOG.md index 44b1ac0..a06cb2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to `laravel-env-keys-checker` will be documented in this file. +## v1.4.1 - 2024-10-13 + +### What's Changed + +* Added no progress option by @fkrzski in https://github.com/msamgan/laravel-env-keys-checker/pull/14 + +### New Contributors + +* @fkrzski made their first contribution in https://github.com/msamgan/laravel-env-keys-checker/pull/14 + +**Full Changelog**: https://github.com/msamgan/laravel-env-keys-checker/compare/v1.4.0...v1.4.1 + ## v1.4.0 - 2024-10-08 ### What's Changed diff --git a/README.md b/README.md index 02275c1..7662582 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,12 @@ ![image](https://github.com/user-attachments/assets/8f80ef4a-a777-46ed-bc49-e70e3c1bec60) - [![Latest Version on Packagist](https://img.shields.io/packagist/v/msamgan/laravel-env-keys-checker.svg?style=flat-square)](https://packagist.org/packages/msamgan/laravel-env-keys-checker) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/msamgan/laravel-env-keys-checker/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/msamgan/laravel-env-keys-checker/actions?query=workflow%3Arun-tests+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/msamgan/laravel-env-keys-checker.svg?style=flat-square)](https://packagist.org/packages/msamgan/laravel-env-keys-checker) -This package is used to check if all the keys are available across all the .env files. -This package is useful when you have multiple .env files, -and you want to make sure that all the keys are available across all the .env files. +This package checks if all the keys are available across all the .env files. This package is useful when you have +multiple .env files and want to ensure all the keys are available across all the .env files. With a team of developers, it is possible that some developers might forget to add the keys they used in their .env file to the .env.example file or the other way around. @@ -20,6 +18,7 @@ to the .env.example file or the other way around. - [Installation](#installation) - [Usage](#usage) - [To check if all the keys are available across all the .env files.](#to-check-if-all-the-keys-are-available-across-all-the-env-files) + - [Options](#options) - [To check if the .env and other provided files are present in .gitignore.](#to-check-if-the-env-and-other-provided-files-are-present-in-gitignore) - [In Test](#in-test) - [To check if all the keys are available across all the .env files.](#to-check-if-all-the-keys-are-available-across-all-the-env-files-1) @@ -65,6 +64,15 @@ php artisan vendor:publish --tag="env-keys-checker-config" php artisan env:keys-check ``` +#### Options + +``--auto-add``: This option will add the missing keys to the .env files automatically. +The possible values are ``ask``, +``auto``, and ``none``. +The default value is ``ask``. + +``--no-progress``: This option will disable the progress bar. + ### To check if the .env and other provided files are present in .gitignore. ```bash diff --git a/src/Commands/KeysCheckerCommand.php b/src/Commands/KeysCheckerCommand.php index 931b9e6..ce75ad0 100644 --- a/src/Commands/KeysCheckerCommand.php +++ b/src/Commands/KeysCheckerCommand.php @@ -18,8 +18,7 @@ class KeysCheckerCommand extends Command { use HelperFunctions; - public $signature = 'env:keys-check - {--auto-add= : Auto add missing keys to the .env files. Available options: ask, auto, none}'; + public $signature = 'env:keys-check {--auto-add=} {--no-progress}'; public $description = 'Check if all keys in .env file are present across all .env files. Like .env, .env.example, .env.testing, etc.'; @@ -57,12 +56,18 @@ public function handle(GetKeys $getKeys, CheckKeys $checkKeys, AddKeys $addKeys) $missingKeys = collect(); - progress( - label: 'Checking keys...', - steps: $keys, - callback: fn ($key) => $checkKeys->handle(keyData: $key, envFiles: $envFiles, missingKeys: $missingKeys), - hint: 'It won\'t take long.' - ); + $processKeys = fn ($key) => $checkKeys->handle(keyData: $key, envFiles: $envFiles, missingKeys: $missingKeys); + + if ($this->option('no-progress')) { + $keys->each($processKeys); + } else { + progress( + label: 'Checking keys...', + steps: $keys, + callback: $processKeys, + hint: 'It won\'t take long.' + ); + } if ($missingKeys->isEmpty()) { $this->showSuccessInfo(