Skip to content
/ tab Public

A tiny Go utility that formats plain text into neatly aligned columns.

License

Notifications You must be signed in to change notification settings

grimdork/tab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tab

A tiny Go utility that formats plain text into neatly aligned columns.


Features

  • Automatically aligns text into columns based on whitespace.
  • Optional two-column mode (-2) for option → description formatting.
  • Works with files or standard input.
  • Portable, dependency-free Go program.
  • Builds with TinyGo.
  • Simple and fast — perfect for scripts or terminal output cleanup.

Usage

tab [options] [file]

If no file is specified, tab reads from stdin.

Options

Option Description
-2 Split each line into two columns: the first word in the left column, and the rest of the line in the right column.
-h, --help Show help and exit.

Examples

Normal column alignment

Input (data.txt):

Name Age City
Anne 32 Oslo
Birger 7 Bergen
Camilla 54 Trondheim

Run:

tab data.txt

Output:

Name     Age 	City
Anne     32  	Oslo
Birger   7   	Bergen
Camilla  54  	Trondheim

Two-column help-style formatting

Input (help.txt):

--help Show this help message and exit
--version Print version information

Run:

tab -2 help.txt

Output:

--help   	Show this help message and exit
--version	Print version information
--config 	<file> Use the specified configuration file

Build

go build

or more optimised:

go build -ldflags "-s -w"

or very optimised if you have TinyGo installed:

tinygo build -gc=leaking -panic=print -no-debug -opt=z

Then copy the binary somewhere in your $PATH, for example:

mv tab ~/bin

Licence

MIT License © 2025 Feel free to copy, modify, and use.

About

A tiny Go utility that formats plain text into neatly aligned columns.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published