Functions to format provided input.
Format seconds to human readable format.
echo "$(format::human_readable_seconds "356786")"
#Output
4 days 3 hours 6 minute(s) and 26 seconds
Format bytes to human readable format.
echo "$(format::bytes_to_human "2250")"
#Output
2.19 KB
Remove Ansi escape sequences from given text.
format::strip_ansi "\e[1m\e[91mThis is bold red text\e(B\e[m.\e[92mThis is green text.\e(B\e[m"
#Output
This is bold red text.This is green text.
Prints the given text to centre of terminal.
format::text_center "This text is in centre of the terminal." "-"
Format String to print beautiful report.
format::report "Initialising mission state" "Success"
#Output
Initialising mission state ....................................................................[ Success ]
Trim given text to width of the terminal window.
format::trim_text_to_term "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." "This is part of second sentence."
#Output
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod..This is part of second sentence.