#!/bin/sh
#
# align - align columns/tabular data at CHAR.
# dependencies: column(1) (util-linux or bsdextrautils)
# for use in vim: `!align =`
#
# usage:
#   align stdin on the = character:
#     :!align =
#   align selected text on commas:
#     :'<,'>!a ,
#   same thing but right aligned:
#     :'<,'>!a , -R0
#
# ---
# see: https://leahneukirchen.org/dotfiles/bin/align

# CHAR="${1:?'Missing character to align on.'}"
# shift

CHAR="${1:-"#"}"
shift
exec column -t -s "${CHAR}" -o "${CHAR}" "$@"
# exec align-columns -d "${CHAR}" "$@"
