golioth / golioth-zephyr-sdk

Golioth SDK For Zephyr
https://www.golioth.io
Apache License 2.0
68 stars 19 forks source link

samples: common: deduplicate json/plain status printing #280

Closed mniestroj closed 2 years ago

mniestroj commented 2 years ago

So far there was no consistence around using:

as well as with:

Unify those and always use shell_error() in the first case and shell_print() in the latter case. Note that this changes color of some printed strings from green to default (white/grey), but this was done on purpose (to improve consistency of printed strings across other Zephyr shell commands, that also use default font color in most cases).

Change also single invocation of shell_fprintf(..., SHELL_WARNING, ...) to shell_warn().

Introduce helpers that allow to deduplicate some boilerplate related to printing in JSON or in plain text.

Format string are now the same for JSON and plain text, so resulting code is less prone to copy-paste errors.

Note that all format/message strings now start with uppercase for consistency across JSON and plain text output.

github-actions[bot] commented 2 years ago

Visit the preview URL for this PR (updated for commit 220b295):

https://golioth-zephyr-sdk-doxygen-dev--pr280-samples-shell-im-ocothwnu.web.app

(expires Thu, 22 Sep 2022 15:22:11 GMT)

šŸ”„ via Firebase Hosting GitHub Action šŸŒŽ