Expand description
A collection of utilities which wrap common tasks needed in cli utilities
Results/Options are downgraded to Options/bools by handling errors within the wrappers using bog.
§Error handling strategies:
§Macros
Unwrap errors from Result/Option with (get/unwrap_or) and immediately return
§BogOkExt
Downgrade errors to options by bogging the error
§BogUnwrapExt
Unwrap infallible errors or bog and exit process
§Misc
A prefix can be added to the error with prefix_err
§Additional
These functions are mostly not composable
Re-exports§
pub use bog::BOGGER;
Modules§
- baccarat
- bait
- bath
- Path manipulation
- bo
- IO
- bog
- Display colored log-style messages for CLI tools
Performance is no concern (hence
bog), only convenience and style. - bother
- broc
- Utilities for (spawning) processes
- bs
- Filesystem set, check, read
- bum
Macros§
- _dbg
- dbg!/log::debug! and return the value.
- _eprint
- Prints to stderr like
eprintln!but only in debug builds - _ibog
- _info
- Info log in debug
- _wbog
- auto_
impl - cbog
- concat_
- dbog
- define_
collection_ wrapper - Implement a wrapper around a container type (i.e. HashMap). Implements the Deref, DerefMut, Default and IntoIterator/FromIterator traits and the new function.
- define_
const_ default - define_
either - Macro to define an
Eitherenum with exactly two variants: Left, Right. - define_
restricted_ wrapper - Implement a restricted wrapper around an inner type:
- define_
transparent_ wrapper - Implement a transparent wrapper around an inner type:
- define_
when - Macro to define a
Whenenum with exactly three variants: Never, Auto, Always. Preserves enum and variant metadata. - ebog
- env_
vars - expr_
as_ path_ fn - Cache the expression into a fn() -> &’static Path
- ibog
- mbog
- nbog
- prints
- Write newline-delimited strings directly to stdout without dynamic dispatch.
- slice_
- Map a function over the elements of a [].
By default, .to_string() is applied.
To specify the mapping, a function or type followed by
|can precede the elements. The pure prefix:is shorthand for calling .into(). - unwrap
- Examples
- vec_
- Map a function over the elements of a vec![].
By default, .to_string() is applied.
To specify the mapping, a function or type followed by
|can precede the elements. The pure prefix:is shorthand for calling .into(). - wbog