nutools/lless

32 lines
842 B
Bash
Executable File

#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source "$(dirname "$0")/lib/ulib/auto" || exit 1
function display_help() {
uecho "$scriptname: frontend de less pour lire des fichiers encodés en latin1
USAGE
$scriptname [options] files...
OPTIONS
-S, --chop-long-lines
-r, --raw-control-chars
-R, --RAW-CONTROL-CHARS
-e, --quit-at-eof
-E, --QUIT-AT-EOF
options de less qui sont reprises telles quelles"
}
lessopts=()
args=(
--help '$exit_with display_help'
-S,--chop-long-lines '$lessopts+=(-S)'
-r,--raw-control-chars '$lessopts+=(-r)'
-R,--RAW-CONTROL-CHARS '$lessopts+=(-R)'
-e,--quit-at-eof '$lessopts+=(-e)'
-E,--QUIT-AT-EOF '$lessopts+=(-E)'
)
parse_args "$@"; set -- "${args[@]}"
iconv -f latin1 -t utf-8 "$@" | less "${lessopts[@]}"