Skip to content

feat(command): add verbosity levels (-q, -v, -vv)#54

Merged
usernane merged 1 commit into
devfrom
feat/verbosity-levels
Jun 13, 2026
Merged

feat(command): add verbosity levels (-q, -v, -vv)#54
usernane merged 1 commit into
devfrom
feat/verbosity-levels

Conversation

@usernane

Copy link
Copy Markdown
Member

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

  • Added Verbosity class with QUIET(0), NORMAL(1), VERBOSE(2), DEBUG(3) constants
  • Added -q, -v, -vv global arguments to Runner
  • Added getVerbosity() and setVerbosity() to Runner
  • Added verbose(string $msg) method to Command (shown at -v or higher)
  • Added debug(string $msg) method to Command (shown at -vv only)
  • Gated info() and success() — suppressed in quiet mode (-q)
  • error() and warning() always shown regardless of verbosity
  • println() and prints() unchanged (unconditional low-level primitives)
  • Verbosity flags stripped from args passed to commands
  • Renamed removeAnsiArgsremoveGlobalFlags (handles all global flags)

How to Test / Verify

  • tests/WebFiori/Tests/Cli/VerbosityTest.php (13 tests, 46 assertions)
  • Updated RunnerTest.php for new global args in help output

Run: composer test

Breaking Changes and Migration Steps

None. Default verbosity is NORMAL — all existing behavior preserved.

Checklist

  • I reviewed my own diff before requesting review
  • My commits follow Conventional Commits
  • I added/updated tests (or explained why not)
  • I updated docs (if needed) Docs Repo
  • I ran lint/cs-fixer (if applicable) (composer fix-cs)
  • I considered backward compatibility
  • I considered security

Related issues

Closes #46

- 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
@usernane usernane merged commit 14b17ef into dev Jun 13, 2026
1 check passed
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.08%. Comparing base (32eddbb) to head (8142001).
⚠️ Report is 2 commits behind head on dev.

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              
Flag Coverage Δ
php-8.3 88.08% <100.00%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant