clprint 0.1.0

A command line printer utility
Documentation
  • Coverage
  • 100%
    5 out of 5 items documented5 out of 5 items with examples
  • Size
  • Source code size: 10.8 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.21 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • rallhannes/clprint
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • rallhannes

clprint

A simple Rust utility crate for printing clean, formatted text blocks in the terminal using # borders.


Features

  • Print titles with # borders
  • Print word-wrapped body text with # side borders
  • Print a full box (title + text + closing border) in one call
  • Supports manual line breaks with \n

Installation

Add clprint to your Cargo.toml:

[dependencies]
clprint = "0.1.0"

Usage

Full box

use clprint::print_hashtag_box;

fn main() {
    print_hashtag_box("Hello", "Welcome to clprint!", 40);
}

Output:

########################################
# Hello                               #
########################################
# Welcome to clprint!                 #
########################################

Title only

use clprint::print_hashtag_title;

print_hashtag_title("My Title", 40);

Output:

########################################
# My Title                            #
########################################

Body text with word wrapping

use clprint::print_hashtag_text;

print_hashtag_text("This is a longer text that will be wrapped automatically.", 30);

Output:

# This is a longer text that  #
# will be wrapped              #
# automatically.               #

Manual line breaks

use clprint::print_hashtag_text;

print_hashtag_text("Line one\nLine two\nLine three", 30);

Output:

# Line one                    #
# Line two                    #
# Line three                  #

Building a box manually

If you need more control, you can use the individual functions:

use clprint::{print_hashtag_title, print_hashtag_text, print_hashtag_end};

print_hashtag_title("Warning", 40);
print_hashtag_text("Something went wrong. Please check your input.", 40);
print_hashtag_text("Contact support if the issue persists.", 40);
print_hashtag_end(40);

License

MIT