Skip to content

Conversation

@aazsamir
Copy link
Contributor

@aazsamir aazsamir commented Nov 14, 2024

This pull request brings tempest config:show [format=pretty {dump|pretty|file}] [--search=false] [filter=null] command.
This command loads config loaded by tempest, and dumps it to terminal in given format.

Supported formats are

  • dump: simply dumps all configs using lw function
  • pretty: uses reflection on configs, and shows config as valid JSON. All class entries have @type field to annotate its class
  • file: reads content of resolved configs, and dumps it along with its filepath

Both pretty and file formats are formatted using Highlight.

--filter arg allows to narrow returned configs by filepath or classname.
So this is possible

tempest config:status --filter=database.config.php

and

tempest config:status --filter=DatabaseConfig

--search arg allows you to interactively select the configuration file you want to display with SearchComponent.

@innocenzi
Copy link
Member

So, I have a few thoughts about this:

  • I love the idea

  • I think the current JSON format should be called PRETTY (or similar), so JSON can be a non-formatted JSON string for interop (right now, reading it from stdout prints terminal codes)

  • I think it would be great to allow searching for a specific config file, through the search console component. If I'm looking at config:status, I'm probably looking for a specific config, so this would help me find it.

  • I'm not actually sure about the name config:status. It's not showing the status of a config, but it dumps it. I have no strong opinion about it, but the name doesn't feel right here

@innocenzi innocenzi changed the title feat(framework): config:status command feat(framework): add config:status command Nov 14, 2024
rename `config:status` to `config:show`
rename `json` format to `pretty`
@aazsamir
Copy link
Contributor Author

I think the current JSON format should be called PRETTY (or similar), so JSON can be a non-formatted JSON string for interop (right now, reading it from stdout prints terminal codes)

Right now I don't see where non-formatted JSON would be needed (maybe in some SSH connections between different systems?), But I changed it to pretty to get ahead of the future.

I think it would be great to allow searching for a specific config file, through the search console component. If I'm looking at config:status, I'm probably looking for a specific config, so this would help me find it.

I didn't know about SearchComponent, I added a search argument that allows you to select a configuration. I'm not sure about this search naming, if it's not confusing with the filter argument.

I'm not actually sure about the name config:status. It's not showing the status of a config, but it dumps it. I have no strong opinion about it, but the name doesn't feel right

I agree, I changed it to my first take on this, to config:show with the alias config.

@aazsamir aazsamir changed the title feat(framework): add config:status command feat(framework): add config:show command Nov 14, 2024
@innocenzi
Copy link
Member

👌

Right now I don't see where non-formatted JSON would be needed

It's useful for interop—for instance, an IDE extension

if it's not confusing with the filter argument.

The search component and --filter definitely overlap, but the later is still useful for non-pretty output

@brendt
Copy link
Member

brendt commented Nov 14, 2024

I'm not actually sure about the name config:status. It's not showing the status of a config, but it dumps it. I have no strong opinion about it, but the name doesn't feel right here

Agree now that I see it. Let's take config:show, sorry for proposing status 🫣

@innocenzi feel free to review and merge when you're comfortable with it, I really like it 👍

@innocenzi
Copy link
Member

I like this, let's merge :)

@innocenzi innocenzi merged commit 2124577 into tempestphp:main Nov 14, 2024
56 checks passed
@aazsamir aazsamir deleted the feat/config_status_command branch November 14, 2024 23:52
Blurazzle pushed a commit to Blurazzle/tempest-framework that referenced this pull request Mar 19, 2025
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.

3 participants