Skip to content
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: spark routes option to sort by handler #7015

Merged
merged 4 commits into from
Jan 7, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Dec 24, 2022

Description
Supersedes #6415

  • add option -h to sort by handler
$ php spark routes

CodeIgniter v4.2.11 Command Line Tool - Server Time: 2022-12-24 02:10:28 UTC+00:00

+--------+------------------------------+------+---------------------------------------------+----------------+---------------+
| Method | Route                        | Name | Handler                                     | Before Filters | After Filters |
+--------+------------------------------+------+---------------------------------------------+----------------+---------------+
| GET    | /                            | »    | \App\Controllers\Home::index                |                | toolbar       |
| GET    | bbs/index                    | »    | \App\Controllers\Bbs::index                 |                | toolbar       |
| GET    | bbs/post                     | »    | \App\Controllers\Bbs::post                  |                | toolbar       |
| GET    | form                         | »    | \App\Controllers\Form::index                |                | toolbar       |
| GET    | shop/cart                    | »    | \App\Controllers\Shop\Cart::index           |                | toolbar       |
| GET    | shop/index/([0-9]+)          | »    | \App\Controllers\Shop\Index::index/$1       |                | toolbar       |
| GET    | shop/index/([0-9]+)/([0-9]+) | »    | \App\Controllers\Shop\Index::index/$1/$2    |                | toolbar       |
| GET    | shop/product/([0-9]+)        | »    | \App\Controllers\Shop\Product::index/$1     |                | toolbar       |
| GET    | shop/search                  | »    | \App\Controllers\Shop\Search::index         |                | toolbar       |
| GET    | shop/search/([0-9]+)         | »    | \App\Controllers\Shop\Search::index/$1      |                | toolbar       |
| POST   | bbs/confirm                  | »    | \App\Controllers\Bbs::confirm               |                | toolbar       |
| POST   | bbs/delete/([0-9]+)          | »    | \App\Controllers\Bbs::delete/$1             |                | toolbar       |
| POST   | bbs/insert                   | »    | \App\Controllers\Bbs::insert                |                | toolbar       |
| POST   | form                         | »    | \App\Controllers\Form::index                |                | toolbar       |
| POST   | form/confirm                 | »    | \App\Controllers\Form::confirm              |                | toolbar       |
| POST   | form/send                    | »    | \App\Controllers\Form::send                 |                | toolbar       |
| POST   | shop/add/([0-9]+)            | »    | \App\Controllers\Shop\Cart::add/$1          |                | toolbar       |
| POST   | shop/customer_info           | »    | \App\Controllers\Shop\CustomerInfo::index   |                | toolbar       |
| POST   | shop/confirm                 | »    | \App\Controllers\Shop\CustomerInfo::confirm |                | toolbar       |
| POST   | shop/order                   | »    | \App\Controllers\Shop\Order::index          |                | toolbar       |
+--------+------------------------------+------+---------------------------------------------+----------------+---------------+
$ php spark routes -h

CodeIgniter v4.2.11 Command Line Tool - Server Time: 2022-12-24 02:10:32 UTC+00:00

+--------+------------------------------+------+---------------------------------------------+----------------+---------------+
| Method | Route                        | Name | Handler ↓                                   | Before Filters | After Filters |
+--------+------------------------------+------+---------------------------------------------+----------------+---------------+
| POST   | bbs/confirm                  | »    | \App\Controllers\Bbs::confirm               |                | toolbar       |
| POST   | bbs/delete/([0-9]+)          | »    | \App\Controllers\Bbs::delete/$1             |                | toolbar       |
| GET    | bbs/index                    | »    | \App\Controllers\Bbs::index                 |                | toolbar       |
| POST   | bbs/insert                   | »    | \App\Controllers\Bbs::insert                |                | toolbar       |
| GET    | bbs/post                     | »    | \App\Controllers\Bbs::post                  |                | toolbar       |
| POST   | form/confirm                 | »    | \App\Controllers\Form::confirm              |                | toolbar       |
| GET    | form                         | »    | \App\Controllers\Form::index                |                | toolbar       |
| POST   | form                         | »    | \App\Controllers\Form::index                |                | toolbar       |
| POST   | form/send                    | »    | \App\Controllers\Form::send                 |                | toolbar       |
| GET    | /                            | »    | \App\Controllers\Home::index                |                | toolbar       |
| POST   | shop/add/([0-9]+)            | »    | \App\Controllers\Shop\Cart::add/$1          |                | toolbar       |
| GET    | shop/cart                    | »    | \App\Controllers\Shop\Cart::index           |                | toolbar       |
| POST   | shop/confirm                 | »    | \App\Controllers\Shop\CustomerInfo::confirm |                | toolbar       |
| POST   | shop/customer_info           | »    | \App\Controllers\Shop\CustomerInfo::index   |                | toolbar       |
| GET    | shop/index/([0-9]+)          | »    | \App\Controllers\Shop\Index::index/$1       |                | toolbar       |
| GET    | shop/index/([0-9]+)/([0-9]+) | »    | \App\Controllers\Shop\Index::index/$1/$2    |                | toolbar       |
| POST   | shop/order                   | »    | \App\Controllers\Shop\Order::index          |                | toolbar       |
| GET    | shop/product/([0-9]+)        | »    | \App\Controllers\Shop\Product::index/$1     |                | toolbar       |
| GET    | shop/search                  | »    | \App\Controllers\Shop\Search::index         |                | toolbar       |
| GET    | shop/search/([0-9]+)         | »    | \App\Controllers\Shop\Search::index/$1      |                | toolbar       |
+--------+------------------------------+------+---------------------------------------------+----------------+---------------+

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added enhancement PRs that improve existing functionalities 4.3 labels Dec 24, 2022
@kenjis kenjis changed the title feat: spark route option to sort by handler feat: spark routes option to sort by handler Dec 24, 2022
Copy link
Contributor

@datamweb datamweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, good job!

Screenshot 2022-12-24 135444

Co-authored-by: Pooya Parsa Dadashi <[email protected]>
@ddevsr
Copy link
Collaborator

ddevsr commented Dec 26, 2022

Why not -s or --sort? In -s can be sort by handler or route or anything can be sort?

Like -s handler or -s route, I am familiar -h is help command

@kenjis
Copy link
Member Author

kenjis commented Dec 26, 2022

-h for Handler.
The other options seem to be mostly unnecessary, so I went with h.

Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-h make sense since I don't think there will be other functionality than sorting here.
But let's see if there will be more voices for the alternative solution.

@kenjis
Copy link
Member Author

kenjis commented Jan 7, 2023

@codeigniter4/core-team If everyone is okay, I would like to merge this.

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sort arrow is a nice touch! 🤗

@kenjis kenjis merged commit 4a6fa4c into codeigniter4:4.3 Jan 7, 2023
@kenjis kenjis deleted the feat-spark-route-sort-by-handler branch January 7, 2023 23:33
@kenjis kenjis mentioned this pull request Jan 7, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.3 enhancement PRs that improve existing functionalities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants