#cli #output #report #verbosity #debug

macro cli-toolbox

Utility library for working with cli output ergonomically

12 releases (7 breaking)

Uses new Rust 2021

0.8.0 Nov 6, 2021
0.7.0 Oct 31, 2021
0.6.1 Oct 30, 2021
0.5.3 Aug 17, 2021
0.1.0 Aug 3, 2021

#164 in Command-line interface

Download history 6/week @ 2022-01-27 3/week @ 2022-02-03 13/week @ 2022-02-17 36/week @ 2022-03-10 48/week @ 2022-03-17 7/week @ 2022-04-07 60/week @ 2022-04-28 77/week @ 2022-05-05 194/week @ 2022-05-12

331 downloads per month

MIT license

42KB
845 lines

cli-toolbox

Utility library for working with cli output ergonomically.

This is not a logging alternative, it's intended to produce output for end user consumption.

It handles three levels of verbosity that can be set dynamically at runtime:

  • Quite - no output
  • Terse - used to provide minimal user output
  • Verbose - used to provide elaborated and/or additional user output

Output Macros

  • debug! - conditionally compiled console debugging output - [debug]

  • report! - conditional console output according to verbosity level - [debug|release]

* debug! is intended to be used during application development

* all other debugging and telemetry output is most likely better served with a logging library

Conditional Code

  • eval! - conditional code execution according to verbosity level - [debug|release]

  • release! - conditional code execution according to verbosity level - [release]

Resources

  • Docs for more detailed information
  • Examples to see it in action

Usage

Each macro is gated by a feature.

No feature is mutually exclusive and can be combined as needed.

  • debug! macro
[dependencies]
cli-toolbox = { version = "0.8", features = ["debug"] }
  • eval! macro
[dependencies]
cli-toolbox = { version = "0.8", features = ["eval"] }
verbosity = "0.1"
  • release! macro
[dependencies]
cli-toolbox = { version = "0.8", features = ["release"] }
verbosity = "0.1"
  • report! macro
[dependencies]
cli-toolbox = { version = "0.8", features = ["report"] }
verbosity = "0.1"

Roadmap

  • ...

Implemented

  • debug! macro
  • eval! macro
  • release! macro
  • report! macro

Dependencies

~0.3–0.8MB
~18K SLoC