From bdcf4df6eb55b6a74d0a8e0580217eed2c6bc6be Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Mon, 13 Oct 2014 08:42:09 +0400 Subject: [PATCH] =?UTF-8?q?support=20d'abbr=C3=A9viations=20pour=20les=20c?= =?UTF-8?q?ommandes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fconv | 12 ++++++------ fnconv | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/fconv b/fconv index 0c26e56..ecff0b1 100755 --- a/fconv +++ b/fconv @@ -23,7 +23,7 @@ OPTIONS tous les deux spécifiés. COMMANDES - conv dest_enc [src_enc] + c, conv dest_enc [src_enc] Convertir le fichier dans un autre encoding. dest_enc est l'encoding destination. Il doit être spécifié. src_enc est l'encoding source. S'il n'est pas spécifié ou vaut 'detect', @@ -36,7 +36,7 @@ COMMANDES crlf cr Convertir respectivement les caractères de fin de ligne en LF, CR/LF ou CR - noaccents + n, noaccents Transformer les caractères accentués en caractères non accentués" } @@ -58,7 +58,7 @@ function detect_enc() { function before_parse_cmd() { case "$1" in - conv) + conv|c) if [ -n "$OPTIMIZE_CONV" ]; then local to="$2" [ -n "$to" ] && setx CONV_TO=__norm_encoding "$to" @@ -100,7 +100,7 @@ function parse_cmd() { case "$cmd" in utf8) parse_cmd conv utf8 "$@";; latin1) parse_cmd conv latin1 "$@";; - conv) + conv|c) local to="$CONV_TO" from="$CONV_FROM" [ -n "$to" ] || to="$1"; shift [ -f "$from" ] || from="${1:-detect}"; shift @@ -129,7 +129,7 @@ function parse_cmd() { lf) echo _nl2lf;; crlf) echo _nl2crlf;; cr) echo _nl2cr;; - noaccents|noa|fixchars) + noaccents|noa|n|fixchars) echo _noaccents;; *) echo "$cmd: commande invalide" @@ -161,7 +161,7 @@ parse_opts + "${PRETTYOPTS[@]}" \ -r,--reverse REVERSE_CONV=1 \ @ args -- "$@" && set -- "${args[@]}" || die "$args" -FILE="$1"; shift +FILE="${1:--}"; shift [ "$FILE" == - ] && FILE=/dev/stdin if [ "$FILE" != /dev/stdin ]; then [ -e "$FILE" ] || die "$FILE: fichier introuvable" diff --git a/fnconv b/fnconv index 63f78ac..b6a0dcb 100755 --- a/fnconv +++ b/fnconv @@ -23,7 +23,7 @@ OPTIONS tous les deux spécifiés. COMMANDES - conv dest_enc [src_enc] + C, conv dest_enc [src_enc] Convertir le nom du fichier dans un autre encoding. dest_enc est l'encoding destination. Il doit être spécifié. src_enc est l'encoding source. S'il n'est pas spécifié ou vaut 'detect', @@ -32,13 +32,13 @@ COMMANDES Equivalent à conv utf8 src_enc latin1 [src_enc] Equivalent à conv latin1 src_enc - noaccents + n, noaccents Transformer les caractères accentués en caractères non accentués - lowercase + l, lowercase Transfomer le nom en minuscule - uppercase + u, uppercase Transformer le nom en majuscule - fixcase + f, fixcase Transformer le nom en minuscule s'il est entièrement en majuscule" } @@ -77,7 +77,7 @@ function detect_enc() { function before_parse_cmd() { case "$1" in - conv) + conv|c) if [ -n "$OPTIMIZE_CONV" ]; then local to="$2" [ -n "$to" ] && setx CONV_TO=__norm_encoding "$to" @@ -120,7 +120,7 @@ function parse_cmd() { case "$cmd" in utf8) parse_cmd conv utf8 "$@";; latin1) parse_cmd conv latin1 "$@";; - conv) + conv|c) local to="$CONV_TO" from="$CONV_FROM" [ -n "$to" ] || to="$1"; shift [ -f "$from" ] || from="${1:-detect}"; shift @@ -146,10 +146,10 @@ function parse_cmd() { qvals iconv -f "$from" -t "$to" "$@" fi ;; - noaccents|noa|fixchars) echo _noaccents;; + noaccents|noa|n|fixchars) echo _noaccents;; lowercase|lower|l) echo _lowercase;; - uppercase|upper|U) echo _uppercase;; - fixcase|fix|c) echo _fixcase;; + uppercase|upper|u) echo _uppercase;; + fixcase|fix|f) echo _fixcase;; *) echo "$cmd: commande invalide" return 1 @@ -197,7 +197,7 @@ parse_opts "${PRETTYOPTS[@]}" \ -r,--reverse REVERSE_CONV=1 \ @ args -- "$@" && set -- "${args[@]}" || die "$args" -FILE="$1"; shift +FILE="${1:--}"; shift [ "$FILE" == - ] && FILE=/dev/stdin if [ "$FILE" != /dev/stdin ]; then [ -e "$FILE" ] || die "$FILE: fichier introuvable"