A command-line utility which aligns a block of text within the terminal (or a specified number of columns), written in Rust.

Overview

align: a command line utility for aligning text.

Crates.io

⭐ Overview

Aligns text within the terminal (or a specified number of columns).
The text is treated as a block, and you can align the content within it, or align it within the space.

πŸ’» Examples:

Screenshot

⌨ Usage

Text is read from stdin (terminal input, pipe in, etc.), formatted according to the options, then written out.

Usage: align [OPTIONS]

Options:
  -o, --outer <OUTER>      Where to align the block of text [default: left] [possible values: left, center, right]
  -i, --inner <INNER>      Where to align text inside the block [default: left] [possible values: left, center, right]
  -a, --align <ALIGN>      Shorthand for specifiying both [possible values: left, center, right]
  -c, --columns <COLUMNS>  Number of columns. Takes text's width if 0, terminal's width if unspecified
  -w, --wrap               Wrap the lines of text to fit in the number of columns
  -t, --trim               Trim the spaces around the lines before aligning
  -k, --keep               Keep the spaces on the right in output
  -b, --bias <BIAS>        Offset if line can't be centered perfectly [default: left] [possible values: left, right]
  -h, --help               Print help (see more with '--help')
  -V, --version            Print version
  • Tip: You can use the command twice to format a block with a specific width, then align it in a bigger space.

Error: "couldn't get terminal width"

This program uses the term_size crate to determine the terminal width by inspecting stdout, stdin, or stderr. If none of these streams is a tty (connected to the terminal), the terminal width can't be calculated.

This can happen if you're redirecting all three streams. Example: echo "test" | align > test.txt 2>&1, which produces Error: "couldn't get terminal width".

In such a case, you must specify the number of columns yourself, see Usage.

πŸ™ Special Thanks

  • clap: Command Line Argument Parser for Rust.
  • term_size: A Rust library to enable getting terminal sizes and dimensions.
  • FOSS and Rust communities πŸ’–.
You might also like...
colorStyle is a library of styles for command-line text write in Rust.
colorStyle is a library of styles for command-line text write in Rust.

Colorstyle colorStyle is a library of styles for command-line text. Inspired by flylog/colorstyle (golang) Example let text = colorstyle::green("gre

hj is a command line tool to convert HTTP/1-style text into JSON

hj hj is a command line tool to convert HTTP/1-style text into JSON. This command is inspired by yusukebe/rj, which is a standalone HTTP client that s

A robust, customizable, blazingly-fast, efficient and easy-to-use command line application to uwu'ify your text!
A robust, customizable, blazingly-fast, efficient and easy-to-use command line application to uwu'ify your text!

uwuifyy A robust, customizable, blazingly-fast, efficient and easy-to-use command line application to uwu'ify your text! Logo Credits: Jade Nelson Tab

A system clipboard command line tools which inspired by pbcopy & pbpaste but better to use.

rclip A command line tool which supports copy a file contents to the system clipboard or copy the contents of the system clipboard to a file. Install

A command line application which sets your wall paper with new image generating pollens once they arrive.

pollenwall Table of Contents pollenwall About Installation Binary releases Build from source Usage Command Line Arguments Running as a service MacOS L

Rust command line utility to quickly display useful secrets in a Kubernetes namespace
Rust command line utility to quickly display useful secrets in a Kubernetes namespace

kube-secrets This is a command line utility for quickly looking at secrets in a Kubernetes namespace that are typically looked at by humans. It specif

fixred is a command line utility to fix outdated links in files with redirect URLs.
fixred is a command line utility to fix outdated links in files with redirect URLs.

fixred fixred is a command line utility to fix outdated links in files with redirect URLs. Installation fixred is installed via cargo package manager.

 A command-line utility that creates project structure.
A command-line utility that creates project structure.

petridish A command-line utility that creates project structure. If you have heard of the cookiecutter project, petridish is a rust implementation of

Command line utility for controlling LIFX smart lights

lifxc is a command line utility for controlling LIFX smart lights. Currently, communication over the LIFX LAN protocol is supported.

Releases(1.0.0)
Owner
Khalil Ouali
Computer Engineering student @ FST-UTM - πŸ§πŸ¦€ Hobbyist coder
Khalil Ouali
Command-line HTTP client for sending a POST request to specified URI on each stdin line.

line2httppost Simple tool to read lines from stdin and post each line as separate POST request to a specified URL (TCP connection is reused though). G

Vitaly Shukela 3 Jan 3, 2023
A command-line tool to easily kill processes running on a specified port.

killport killport is a command-line utility for killing processes listening on specific ports. It's designed to be simple, fast, and effective. The to

Francisco JimΓ©nez Cabrera 6 Mar 29, 2023
🌊 ~ seaward is a crawler which searches for links or a specified word in a website.

?? seaward Installation cargo install seaward On NetBSD a pre-compiled binary is available from the official repositories. To install it, simply run:

null 3 Jul 16, 2023
A command line tool for people of transgender experience to replace their deadname within a Git repo.

chowndn (Change Owner from Dead Name) A command line tool for people of transgender experience to replace their dead name within a Git repo. See chown

Christi Miller 23 Dec 6, 2022
A blazingly fast rust-based bionic reader for blazingly fast reading within a terminal console πŸ¦€

This Rust-based CLI tool reads text and returns it back in bionic reading format for blazingly fast loading and even faster reading! Bionic reading is

Ismet Handzic 5 Aug 5, 2023
A minimalist tool for managing block-lists from the terminal.

Block List A minimalist hosts-based tool for managing block lists and ad-blocking. This project uses the excellent and regularly updated Unified Hosts

Oliver Brotchie 7 Aug 14, 2022
A simplified recreation of the command-line utility grep written in Rust.

smolgrep A simplified recreation of the command-line utility grep written in Rust. Download and run Download Rust On Mac/Linux Open a terminal and ent

Thi Dinh 0 Dec 27, 2021
This is a command line utility written in Rust that helps you plan factories in Satisfactory.

Satisfactory Factory Planning Utility This is a command line utility written in Rust that helps you plan factories in Satisfactory. Tell it what you w

Maurdekye 4 Nov 29, 2023
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022
A small command-line application to view images from the terminal written in Rust.

A small command-line application to view images from the terminal written in Rust. It is basically the front-end of viuer

Atanas Yankov 1.9k Jan 3, 2023