From 0e7c9623c595d61167eb33cfe36191d1556a0b68 Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Sat, 2 Nov 2013 08:01:31 +0400 Subject: [PATCH] ajout de sieve --- lib/templates/templates.conf | 3 ++- lib/templates/text | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/templates/templates.conf b/lib/templates/templates.conf index adc8922..6e52137 100644 --- a/lib/templates/templates.conf +++ b/lib/templates/templates.conf @@ -10,6 +10,7 @@ EXTS=( txt:text conf:conf sql:sql + sieve:sieve mdt:markdown mdwn:markdown md:markdown text:markdown twp:twpage puml:puml @@ -43,7 +44,7 @@ TEMPLATES=( # Scripts à utiliser pour générer les templates TEMPLS=( - text:text conf:text sql:text + text:text conf:text sql:text sieve:text markdown:wiki twpage:wiki puml:plantuml iuml:plantuml shell:shell diff --git a/lib/templates/text b/lib/templates/text index 68b35a6..2754592 100755 --- a/lib/templates/text +++ b/lib/templates/text @@ -23,9 +23,9 @@ OPTIONS } NAME=text -TEMPLATES=(text conf sql) +TEMPLATES=(text conf sql sieve) NAMES=() -EXTS=(txt conf sql) +EXTS=(txt conf sql sieve) if [ $# -eq 2 ]; then if [ "$1" == "--matches-template" ]; then @@ -92,6 +92,17 @@ function generate_sql() { return 0 } +function generate_sieve() { + local file="$1" + local mode=sieve + + check_overwrite "$1" || return + estep "$(ppath "$file")" + echo >"$file" "-- -*- coding: $encoding ${mode:+mode: $mode }-*- vim:sw=4:sts=4:et:ai:si:sta:fenc=$encoding" + [ -n "$2" ] && array_add "$2" "$file" + return 0 +} + template= edit=1 overwrite= @@ -126,6 +137,7 @@ for file in "$@"; do text|txt|t) generate_text "$file" files2edit || r=$?;; conf|c) generate_conf "$file" files2edit || r=$?;; sql) generate_sql "$file" files2edit || r=$?;; + sieve) generate_sieve "$file" files2edit || r=$?;; *) die "$NAME: template invalide: $t";; esac done