Skip to content
/ align Public
forked from Guitarbum722/align

A general purpose application that aligns text

License

Notifications You must be signed in to change notification settings

mattn/align

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

align

A general purpose application that aligns text

GoDoc Build Status

The focus of this application is to provide a fast, efficient, and useful tool for aligning text. Its creation is the result of inspiration from several other amazing alignment tools, namely column or the Sublime Text plugin AlignTab.

Included

  • A simple yet useful CLI with options to specify your delimiter, input and output files, etc.
  • Align by any string as your delimiter or separator, not just a single character.
  • If your separator string is contained within the data itself, it can be escaped by specifying a text qualifier.
  • Right, Center, or Left justification of each field.

Why?

Sometimes, it's just easier to align a CSV (or delimited file) by its delimiter and view the columns in your plain text editor (which saves you from opening Excel!).

Another use is to align blocks of code by = or =>, etc.

Install

$ go get github.com/Guitarbum722/align
$ make install

$ # build all binaries
$ make release

Usage - CLI examples

Usage: align [-h] [-f] [-o] [-q] [-s] [-d] [-a]
Options:
  -h | --help  help
  -f           input file.  If not specified, pipe input to stdin
  -o           output file. (default: stdout)
  -q           text qualifier (if applicable)
  -s           delimiter (default: ',')
  -d           output delimiter (defaults to the value of sep)
  -a           <left>, <right>, <center> justification (default: left)
  -c           output specific fields (default: all fields)

Specify your input file, output file, delimiter. You can also pipe input to stdin (if the -f option is provided, it will take precedence over Stdin) If no -o option is provided, stdout will be used.

$ align -f input_file.csv -o output_file.csv

$ align -f input_file.csv -o 

$ cat awesome.csv | align

Do you have rows with a different number of fields? This might be more common with code, but align doesn't care!

$ echo "field1|field2\nValue1|Value2\nCoolValue1|CoolValue2|CoolValue3" | align -s \|
field1     | field2
Value1     | Value2
CoolValue1 | CoolValue2 | CoolValue3

It is perfectly acceptable to even use emojis as your input/output delimiters.

first  😮 last     😮 email
Hector 😮 Gonzalez 😮 h.g@nothing.com

Contributions

If you have suggestions or discover a bug, please open an issue. If you think you can make the fix, please use the Fork / Pull Request on your feature branch approach.

About

A general purpose application that aligns text

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages

  • Go 91.1%
  • Shell 6.1%
  • Makefile 2.8%