Conversation
…not reset when Booting (#1162) * fix: The configuredServiceProviders, publishes and publishGroups are not reset when Booting * optimize
* fix: comand cannot be run concurrently * fix ci * fix ci * optimize * optimize * optimize * optimize * optimize global options * fix ci
There was a problem hiding this comment.
Pull Request Overview
This PR bumps the framework version to v1.16.4 and introduces significant improvements to the console application architecture, focusing on better help command support, enhanced concurrency safety, and more robust CLI flag handling.
Key Changes:
- Refactored the
Applicationstruct to eliminate the sharedinstancefield in favor of dynamically constructing CLI commands per invocation, improving thread safety - Added a dedicated
HelpCommandfor consistent help display across the application - Enhanced CLI flag handling with automatic help flag injection and improved help invocation logic
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| support/constant.go | Updates framework version from v1.16.3 to v1.16.4 |
| contracts/console/command.go | Adds Instance() method to Context interface for accessing underlying cli.Command |
| mocks/console/Context.go | Generates mock implementation for new Instance() method |
| console/service_provider.go | Updates usage text and registers new HelpCommand |
| console/console/help_command.go | Introduces new HelpCommand for displaying available commands |
| console/cli_context.go | Implements Instance() method returning the underlying cli.Command |
| console/application.go | Refactors Application to build commands dynamically and adds automatic help flag injection |
| console/application_test.go | Adds concurrent execution tests and updates assertions for new flag count |
| console/cli_helper.go | Simplifies help templates and removes unused global options formatting |
| console/cli_helper_test.go | Updates tests to reflect new help command behavior and output formats |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1245 +/- ##
==========================================
- Coverage 67.50% 67.48% -0.02%
==========================================
Files 248 249 +1
Lines 14023 14063 +40
==========================================
+ Hits 9466 9491 +25
- Misses 4179 4191 +12
- Partials 378 381 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📑 Description
This pull request makes significant improvements to the Goravel console application, focusing on better help command support, improved concurrency handling, and a more robust CLI flag system. The most important changes include refactoring the console application structure, introducing a built-in help command, enhancing CLI flag handling (especially for help flags), and updating tests to cover new concurrency and help features.
Console Application Refactor and Help Command Integration:
Applicationstruct inconsole/application.goto manage commands, output writer, and metadata directly, replacing the previousinstancefield. Added a newcommand()method to dynamically construct the CLI command structure, improving flexibility and concurrency safety. [1] [2]HelpCommandinconsole/console/help_command.gothat provides a consistent way to show available commands and help information. Registered this command by default in the service provider. [1] [2]CLI Flag Handling and Help Improvements:
console/application.goby automatically adding a--help/-hflag to commands if not present, ensuring consistent help availability. Also, modified help invocation logic to use the new help command when no command argument is provided. [1] [2]console/cli_helper.goand related tests to reflect the new help command and flag structure, including more accurate and user-friendly help messages. [1] [2]Concurrency and Testing Enhancements:
console/application_test.goto verify thread safety when running multiple commands simultaneously, using atomic counters and goroutines. [1] [2]Interface and Mock Updates:
console.Contextinterface incontracts/console/command.goto expose the underlyingcli.Commandinstance, supporting advanced help and context features. Updated mocks accordingly. [1] [2]Other Minor Updates:
v1.16.4insupport/constant.go.These changes collectively modernize the Goravel console experience, making it more extensible, user-friendly, and robust under concurrent usage.
✅ Checks