-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: [Command] add options for spark optimize command #9054
base: 4.6
Are you sure you want to change the base?
Conversation
I think it would be easier to understand the options if we use long options names, like |
|
Using long options names i think would take extra time to write it. it's better if we keep it simple. |
@kenjis |
There is no commands that having a short and long options for one action. |
What if you specify all options |
b735f89
to
229f3db
Compare
Please fix coding style, and add test code to prove this works fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much experience with unit testing, so please let me know if it seems right.
Good PR, every person to run actions. |
e7d1f4a
to
b80171e
Compare
@@ -99,32 +115,73 @@ private function removeFile(string $cache): void | |||
} | |||
} | |||
|
|||
private function enableCaching(): void | |||
private function enableCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the method enableCaching()
does disable caching?
It is strange and not intuitive.
Please add a new private method to disable caching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
925af01
to
084d215
Compare
8a7a912
to
5a01629
Compare
f151245
to
d73de63
Compare
Can you guys run the workflow again. It seems everything is fine now. |
* | ||
* @return array<string, string> | ||
*/ | ||
private function disableCaching(): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I see the method name disableCaching()
, I imagine the method disables caching.
But this method just returns an array.
Therefore the method name or the implementation is not good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will send an update, this makes it more flexible.
@@ -99,32 +123,100 @@ private function removeFile(string $cache): void | |||
} | |||
} | |||
|
|||
private function enableCaching(): void | |||
private function runCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what the runConfig()
method dose when I see the method name.
Is updateConfigFile()
better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I see the method name disableCaching(), I imagine the method disables caching.
But this method just returns an array.
Therefore the method name or the implementation is not good.
If disabelCaching()
and enableCaching()
does its job completely, I don't think runCaching()
is needed any more. we just need a process like this.
public function run(array $params)
{
// Parse options
$enableConfigCache = CLI::getOption('c');
$enableLocatorCache = CLI::getOption('l');
$disable = CLI::getOption('d');
try {
if ($disable === true) {
$this->disableCaching();
$this->reinstallDevPackages();
} else {
$this->enableCaching(['config' => $enableConfigCache, 'locator' => $enableLocatorCache]);
$this->removeDevPackages();
}
$this->clearCache();
} catch (RuntimeException) {
CLI::error('The "spark optimize" failed.');
return EXIT_ERROR;
}
return EXIT_SUCCESS;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good! That will be easier to understand.
Description
To make this command more flexible. This PR provides options to allow us to easily enable or disable cache configuration.
Usage
Options
Example
Checklist: