feat: [Command] add options for spark optimize command
Description
To make this command more flexible. This PR provides options to allow us to easily enable or disable cache configuration.
Usage
protected $usage = 'optimize [-c] [-l] [-d]';
Options
protected $options = [
'c' => 'Enable config cache',
'l' => 'Enable locator cache',
'd' => 'Disable config and locator caching',
];
Example
// Enable configCache and locatorCache.
php spark optimize
// Enable configCache only and ignore the others.
php spark optimize -c
// Enable locatorCache only and ignore the others.
php spark optimize -l
// Disable config and locator caching
php spark optimize -d
Checklist:
- [x] Securely signed commits
- [x] Component(s) with PHPDoc blocks, only if necessary or adds value
- [ ] Unit testing, with >80% coverage
- [x] User guide updated
- [x] Conforms to style guide
I think it would be easier to understand the options if we use long options names, like --config-only.
-r is also a bit difficult to understand. --disable or -d may be better?
Using long options names i think would take extra time to write it. it's better if we keep it simple. Or we can create additional options as aliases for each option?
@kenjis -d I think is much better.
Or we can create additional options as aliases for each option?
There is no commands that having a short and long options for one action. So, use short options or use long options.
What if you specify all options spark optimize -c -l -r?
Please fix coding style, and add test code to prove this works fine.
Good PR, every person to run actions.
spark optimize -d does not reinstall dev packages.
Can you guys run the workflow again. It seems everything is fine now.
Hey @warcooft - if you're still interested in this PR will you find the time to fulfill the final suggestions?
I am removing 4.6 label for this PR since it still require some work so we can move forward.
:wave: Hi, @warcooft!
We detected conflicts in your PR against the base branch :speak_no_evil:
You may want to sync :arrows_counterclockwise: your branch with upstream!
Ref: Syncing Your Branch