CodeIgniter4 icon indicating copy to clipboard operation
CodeIgniter4 copied to clipboard

feat: [Command] add options for spark optimize command

Open warcooft opened this issue 1 year ago • 10 comments

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

warcooft avatar Jul 20 '24 10:07 warcooft

I think it would be easier to understand the options if we use long options names, like --config-only.

paulbalandan avatar Jul 20 '24 11:07 paulbalandan

-r is also a bit difficult to understand. --disable or -d may be better?

kenjis avatar Jul 20 '24 11:07 kenjis

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?

warcooft avatar Jul 20 '24 11:07 warcooft

@kenjis -d I think is much better.

warcooft avatar Jul 20 '24 13:07 warcooft

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.

kenjis avatar Jul 24 '24 01:07 kenjis

What if you specify all options spark optimize -c -l -r?

kenjis avatar Jul 24 '24 01:07 kenjis

Please fix coding style, and add test code to prove this works fine.

kenjis avatar Jul 29 '24 09:07 kenjis

Good PR, every person to run actions.

datamweb avatar Jul 29 '24 16:07 datamweb

spark optimize -d does not reinstall dev packages.

kenjis avatar Jul 29 '24 23:07 kenjis

Can you guys run the workflow again. It seems everything is fine now.

warcooft avatar Jul 30 '24 08:07 warcooft

Hey @warcooft - if you're still interested in this PR will you find the time to fulfill the final suggestions?

michalsn avatar Dec 21 '24 18:12 michalsn

I am removing 4.6 label for this PR since it still require some work so we can move forward.

samsonasik avatar Jan 08 '25 10:01 samsonasik

: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

github-actions[bot] avatar Jan 13 '25 04:01 github-actions[bot]