citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

commit cebd160d1b825791ca27fb9716a219c595b149a0
parent bbfaa3fc264d63258ad931f5b80c4ac385d8f451
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 19 Sep 2020 05:04:45 -0700

bin/lessp: use for lesspipe.sh instead

Diffstat:
Mbin/lessp | 27++++++---------------------
1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/bin/lessp b/bin/lessp @@ -1,25 +1,10 @@ #!/usr/bin/env bash -colorize () { - chroma -f terminal "$1" | less -R -} +export LESSOPEN="|lesspipe.sh %s" -usage () { - printf "usage: lessp file.txt\n" >&2 - printf " lessp txt < file.txt\n" >&2 - exit 1 -} - -[ $# -eq 0 ] && usage - -if [ -t 0 ]; then - [ $# -eq 0 ] && usage - colorize "$1" -else - [ $# -eq 0 ] && usage - ext="$1" - tmp="$(mktemp).$ext" - cat > "$tmp" - colorize "$tmp" - rm -f "$tmp" +if [ -f "${1}.line" ] +then + LESS+=" +$(cat "${1}.line")" fi + +exec less "$@"