ajout de ldiff

This commit is contained in:
Jephté Clain 2023-07-10 16:33:31 +04:00
parent 9c6e7a8750
commit cff4833370
2 changed files with 34 additions and 1 deletions

33
ldiff Executable file
View File

@ -0,0 +1,33 @@
#!/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 diff pour comparer deux fichiers encodés en latin1
USAGE
$scriptname [options] Lfile Rfile
OPTIONS
-u, -U, --unified N
-w, --ignore-all-space
-B, --ignore-blank-lines
options de diff qui sont reprises telles quelles"
}
diffopts=()
args=(
--help '$exit_with display_help'
-u '$diffopts+=(-u)'
-U:,--unified: '$diffopts+=(-U "$value_")'
-w,--ignore-all-space '$diffopts+=(-w)'
-B,--ignore-blank-lines '$diffopts+=(-B)'
)
parse_args "$@"; set -- "${args[@]}"
Lfile="$1"
Rfile="$2"
[ -n "$Lfile" -a -n "$Rfile" ] || die "vous devez spécifier les deux fichiers"
[ -d "$Lfile" -o -d "$Rfile" ] && die "il faut absolument comparer deux fichiers"
diff "${diffopts[@]}" <(iconv -f latin1 -t utf-8 "$Lfile") <(iconv -f latin1 -t utf-8 "$Rfile")

2
lless
View File

@ -14,7 +14,7 @@ OPTIONS
-R, --RAW-CONTROL-CHARS -R, --RAW-CONTROL-CHARS
-e, --quit-at-eof -e, --quit-at-eof
-E, --QUIT-AT-EOF -E, --QUIT-AT-EOF
options de less qui sont reportées telles quelles" options de less qui sont reprises telles quelles"
} }
lessopts=() lessopts=()