Skip to content

[9.x] Artisan about Command#43147

Merged
taylorotwell merged 1 commit into
9.xfrom
feat/artisan-about-command
Jul 15, 2022
Merged

[9.x] Artisan about Command#43147
taylorotwell merged 1 commit into
9.xfrom
feat/artisan-about-command

Conversation

@jbrooksuk

@jbrooksuk jbrooksuk commented Jul 12, 2022

Copy link
Copy Markdown
Member

This PR introduces a new about command that displays output about the system environment and configuration of the user's application. The command is inspired by Rails' own about command, though it's beautiful and has some additional powers 🪄

CleanShot 2022-07-13 at 12 08 46@2x

The command includes its own API so that applications and packages may push data into existing sections or create a new section with its own data:

use Illuminate\Foundation\Console\AboutCommand;

AboutCommand::add('Laravel Vapor', 'Vapor Runtime', '1.0.0');

You can also add multiple items:

AboutCommand::add('Environment', [
    'Laravel Cashier' => 'Stripe',
    'Laravel Nova' => '4.0.0'
]);

It's expected that packages will start to add their own sections of information, which could make this command output a lot of information. You can choose to filter down certain sections with --only and pass a comma-separated list of sections in snake_case.

CleanShot 2022-07-13 at 12 10 13@2x

Finally, you can choose to output this information as JSON by using the --json option (which can also be combined with --only):

CleanShot 2022-07-13 at 12 11 40@2x

Comment thread src/Illuminate/Foundation/Console/AboutCommand.php Outdated
Comment thread src/Illuminate/Support/Composer.php
@danharrin

Copy link
Copy Markdown
Contributor

This is great, for package maintainers, it will allow us to more easily get debugging information from our users, which will help us fix issues. Not just version numbers, but checking if they have fallen into common traps like not linking their public storage directory.

Very nice!

Comment thread src/Illuminate/Foundation/Console/AboutCommand.php Outdated
Comment thread src/Illuminate/Foundation/Console/AboutCommand.php
@dillingham

dillingham commented Jul 12, 2022

Copy link
Copy Markdown
Contributor

Might be cool to have about as an overview with a table of contents of registered abouts

and specific sections broken down by key because the about page might get pretty lengthy

php artisan about vapor

I could see a nice package for php artisan about code using the stats package

Models....................10
Controllers...............50
Avg Methods...............5

@pxlrbt

pxlrbt commented Jul 13, 2022

Copy link
Copy Markdown
Contributor

Another approach for many packages could be adding comma-separated filters:

php artisan about --only=environment,laravel_nova

@voidgraphics

Copy link
Copy Markdown
Contributor

Great PR, it's a little hard to read though with the values being so far from the keys. Especially in full screen.

@fgaroby

fgaroby commented Jul 13, 2022

Copy link
Copy Markdown
Contributor

@pxlrbt: wouldn't it be better using the vendor/package_name syntax ?

@jbrooksuk

Copy link
Copy Markdown
Member Author

Okay, I've added --only which accepts a command-separated list of section names in snake case, i.e. Laravel Nova => laravel_nova.

I've also added an about method to ServiceProvider as a shortcut to adding sections.

@jbrooksuk

Copy link
Copy Markdown
Member Author

Great PR, it's a little hard to read though with the values being so far from the keys. Especially in full screen.

The about is dynamic based on the width of your terminal:

CleanShot 2022-07-13 at 10 56 40@2x

@voidgraphics

Copy link
Copy Markdown
Contributor

Great PR, it's a little hard to read though with the values being so far from the keys. Especially in full screen.

The about is dynamic based on the width of your terminal:

That is the problem I am bringing up. Full-screen terminal windows will have the key/values separated by a lot of dots, making it difficult to read because they are on opposite ends of the screen. It's not a huge issue, but maybe there are other, more legible layout options out there.

@sebdesign

Copy link
Copy Markdown
Contributor

I agree with @voidgraphics, from a UX standpoint, the left-aligned words and the right-aligned words are too far away from each other, and the dot leaders do not always help when a terminal window is full-width.

This design is generally used in table of contents in books, or in restaurant menus, where the page layout is portrait (the width is narrower than the height). It does not work so well in landscape layouts, where the eyes have to scan a lot of width to match the left word with the right word.

@jbrooksuk
jbrooksuk marked this pull request as draft July 13, 2022 10:58
@jbrooksuk

Copy link
Copy Markdown
Member Author

We'll address this in the Console UI Improvements PR, on which this PR is based on.

@jbrooksuk
jbrooksuk force-pushed the feat/artisan-about-command branch from e8ddee8 to 8a14a60 Compare July 13, 2022 11:33
@jbrooksuk
jbrooksuk marked this pull request as ready for review July 13, 2022 14:19
@dennisprudlo

Copy link
Copy Markdown
Contributor

@jbrooksuk Just a thought: How about getting rid of the --only option and use an optional argument list instead?
So about {sections?*} {--json}. This way the command reads better:

php artisan about environment
php artisan about environment laravel_nova some_other_section --json

@jbrooksuk
jbrooksuk marked this pull request as draft July 14, 2022 14:19
Base automatically changed from feat/console-ui-improvements to 9.x July 14, 2022 14:38
@jbrooksuk
jbrooksuk force-pushed the feat/artisan-about-command branch from 2fb0fc1 to 1daf66c Compare July 14, 2022 17:30
@jbrooksuk
jbrooksuk force-pushed the feat/artisan-about-command branch from 1daf66c to a7f16e7 Compare July 14, 2022 17:33
@jbrooksuk
jbrooksuk marked this pull request as ready for review July 14, 2022 17:34
@taylorotwell
taylorotwell merged commit 3e9fe2b into 9.x Jul 15, 2022
@taylorotwell
taylorotwell deleted the feat/artisan-about-command branch July 15, 2022 13:49
@omerbaflah

Copy link
Copy Markdown

Great work! @jbrooksuk 👏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.