From 98ee889d7a52bba1a78c79b626f0768cf2c465f1 Mon Sep 17 00:00:00 2001 From: Leonardo Hipolito Date: Thu, 7 Aug 2025 15:31:41 -0300 Subject: [PATCH] feat: add option to scan multiple directories --- .../LaravelActionsIdeHelperCommand.php | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/Commands/LaravelActionsIdeHelperCommand.php b/src/Commands/LaravelActionsIdeHelperCommand.php index 0b72993..be2969a 100644 --- a/src/Commands/LaravelActionsIdeHelperCommand.php +++ b/src/Commands/LaravelActionsIdeHelperCommand.php @@ -18,18 +18,32 @@ class LaravelActionsIdeHelperCommand extends Command { - public $signature = 'ide-helper:actions'; + public $signature = 'ide-helper:actions {--dir=* : The extra directories to scan for actions}'; public $description = 'Generate a new IDE Helper file for Laravel Actions.'; public function handle() { - $actionsPath = Path::join(app_path() . '/Actions'); + $actionsPaths = [ + Path::join(app_path() . '/Actions') + ]; + if ($this->option('dir')) { + $actionsPaths = array_merge($actionsPaths, array_map('base_path', $this->option('dir'))); + } $outfile = Path::join(base_path(), '/_ide_helper_actions.php'); - - $actionInfos = ActionInfoFactory::create($actionsPath); + $actionInfos=[]; + foreach($actionsPaths as $actionsPath) { + if(!is_dir($actionsPath)) { + continue; + } + $actionInfos+=ActionInfoFactory::create($actionsPath); + } + if (empty($actionInfos)) { + $this->warn('No actions found in the specified directories.'); + return; + } $result = BuildIdeHelper::create()->build($actionInfos);