Skip to content

Commit

Permalink
Add the possibility to override the cache file path in command line (#…
Browse files Browse the repository at this point in the history
…255)

We have a bundle that defined the code style for all our projects. This bundle is therefore shared by multiple projects.
We need to have the possibility to define, by project, the path of the cache file.

This pull request allow the user to do it by given the path of the cache file in the command line.
  • Loading branch information
jimmyklein-actual authored Mar 15, 2024
1 parent d34ace6 commit fb4e240
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/Commands/DefaultCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected function configure()
new InputOption('test', '', InputOption::VALUE_NONE, 'Test for code style errors without fixing them'),
new InputOption('dirty', '', InputOption::VALUE_NONE, 'Only fix files that have uncommitted changes'),
new InputOption('format', '', InputOption::VALUE_REQUIRED, 'The output format that should be used'),
new InputOption('cache-file', '', InputArgument::OPTIONAL, 'The path to the cache file'),
]
);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Factories/ConfigurationResolverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function fromIO($input, $output)
'dry-run' => $input->getOption('test'),
'path' => $path,
'path-mode' => ConfigurationResolver::PATH_MODE_OVERRIDE,
'cache-file' => $localConfiguration->cacheFile() ?? implode(DIRECTORY_SEPARATOR, [
'cache-file' => $input->getOption('cache-file') ?? $localConfiguration->cacheFile() ?? implode(DIRECTORY_SEPARATOR, [
realpath(sys_get_temp_dir()),
md5(
app()->isProduction()
Expand Down

0 comments on commit fb4e240

Please sign in to comment.