feat(ui): add cons_show_warning() (issue #87) #175

Open
jabber.developer2 wants to merge 1 commits from feat/cons-show-warning-87 into master
Collaborator

The console offered cons_show() for information and cons_show_error() for failures, with nothing in between. A caller reporting a condition the user should notice — but that did not stop the operation — had to either hide it among ordinary output or dress it up as an error.

cons_show_warning() fills that gap. It follows cons_show_error() closely: same formatting, same alert behaviour, input is not blocked. What differs is the level — it prints through the new THEME_WARNING item and prefixes the text with Warning: , so callers no longer spell the prefix out themselves.

Theming. THEME_WARNING sits next to THEME_ERROR and defaults to yellow. Themes that do not define a warning colour fall back to that default, so none of the bundled themes needed changing; a theme can override it with a warning= line exactly as it does for error=.

Logging stays with the caller. console.c had no logging calls before this change, and the same convention is kept here: the caller knows the context and logs the technical detail, while the console shows the user-facing text. Logging inside the function would have produced two differently-worded entries per event for callers that already log.

Test support. stub_ui gains the matching stub plus expect_cons_show_warning() / expect_any_cons_show_warning(), mirroring the helpers that already exist for errors.

The first consumer is #173, which currently reports six transport-security conditions through cons_show_error() and prefixes each message with "Security warning:" by hand; that PR is blocked on this one.

Verified: builds clean, 645 unit tests and 139 functional tests pass.

Куыщдмуы #87

The console offered `cons_show()` for information and `cons_show_error()` for failures, with nothing in between. A caller reporting a condition the user should notice — but that did not stop the operation — had to either hide it among ordinary output or dress it up as an error. **`cons_show_warning()`** fills that gap. It follows `cons_show_error()` closely: same formatting, same alert behaviour, input is not blocked. What differs is the level — it prints through the new `THEME_WARNING` item and prefixes the text with `Warning: `, so callers no longer spell the prefix out themselves. **Theming.** `THEME_WARNING` sits next to `THEME_ERROR` and defaults to yellow. Themes that do not define a `warning` colour fall back to that default, so none of the bundled themes needed changing; a theme can override it with a `warning=` line exactly as it does for `error=`. **Logging stays with the caller.** `console.c` had no logging calls before this change, and the same convention is kept here: the caller knows the context and logs the technical detail, while the console shows the user-facing text. Logging inside the function would have produced two differently-worded entries per event for callers that already log. **Test support.** `stub_ui` gains the matching stub plus `expect_cons_show_warning()` / `expect_any_cons_show_warning()`, mirroring the helpers that already exist for errors. The first consumer is #173, which currently reports six transport-security conditions through `cons_show_error()` and prefixes each message with "Security warning:" by hand; that PR is blocked on this one. **Verified:** builds clean, 645 unit tests and 139 functional tests pass. Куыщдмуы #87
jabber.developer2 added 1 commit 2026-08-01 10:13:07 +00:00
feat(ui): add cons_show_warning() (issue #87)
All checks were successful
CI Code / Check coding style (pull_request) Successful in 25s
CI Code / Check spelling (pull_request) Successful in 14s
CI Code / Code Coverage (pull_request) Successful in 3m16s
CI Code / Linux (ubuntu) (pull_request) Successful in 5m7s
CI Code / Linux (arch) (pull_request) Successful in 6m50s
CI Code / Linux (debian) (pull_request) Successful in 8m26s
a878b1e629
The console had cons_show() for information and cons_show_error() for
failures, but nothing in between, so callers reporting a condition the
user should notice had to pick between hiding it and dressing it up as
an error.

cons_show_warning() prints through the new THEME_WARNING item, yellow
by default, and prefixes the text with "Warning: ". Themes that do not
set the "warning" colour fall back to that default, so the bundled
themes need no change. Logging stays with the caller, as it does for
the other console functions.
All checks were successful
CI Code / Check coding style (pull_request) Successful in 25s
Required
Details
CI Code / Check spelling (pull_request) Successful in 14s
Required
Details
CI Code / Code Coverage (pull_request) Successful in 3m16s
Required
Details
CI Code / Linux (ubuntu) (pull_request) Successful in 5m7s
Required
Details
CI Code / Linux (arch) (pull_request) Successful in 6m50s
Required
Details
CI Code / Linux (debian) (pull_request) Successful in 8m26s
Required
Details
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/cons-show-warning-87:feat/cons-show-warning-87
git checkout feat/cons-show-warning-87
Sign in to join this conversation.
No description provided.