feat(command): add verbosity levels (-q, -v, -vv)#54
Merged
Conversation
- Add Verbosity class with QUIET, NORMAL, VERBOSE, DEBUG constants - Add -q, -v, -vv global arguments to Runner - Add getVerbosity() and setVerbosity() to Runner - Add verbose() and debug() methods to Command - Gate info() and success() by verbosity (suppressed in quiet mode) - error() and warning() always shown regardless of verbosity - println() and prints() unchanged (unconditional primitives) - Verbosity flags stripped from args passed to commands Closes #46
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #54 +/- ##
============================================
+ Coverage 87.95% 88.08% +0.13%
- Complexity 1305 1317 +12
============================================
Files 34 34
Lines 3727 3768 +41
============================================
+ Hits 3278 3319 +41
Misses 449 449
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Add verbosity levels to control CLI output detail, following Unix CLI conventions.
Motivation
No way to suppress non-critical output in automated/cron contexts or show extra diagnostics when debugging. Closes #46.
Changes
Verbosityclass withQUIET(0),NORMAL(1),VERBOSE(2),DEBUG(3)constants-q,-v,-vvglobal arguments to RunnergetVerbosity()andsetVerbosity()to Runnerverbose(string $msg)method to Command (shown at-vor higher)debug(string $msg)method to Command (shown at-vvonly)info()andsuccess()— suppressed in quiet mode (-q)error()andwarning()always shown regardless of verbosityprintln()andprints()unchanged (unconditional low-level primitives)removeAnsiArgs→removeGlobalFlags(handles all global flags)How to Test / Verify
tests/WebFiori/Tests/Cli/VerbosityTest.php(13 tests, 46 assertions)RunnerTest.phpfor new global args in help outputRun:
composer testBreaking Changes and Migration Steps
None. Default verbosity is NORMAL — all existing behavior preserved.
Checklist
composer fix-cs)Related issues
Closes #46