ajouter le template fichier vide

This commit is contained in:
Jephté Clain 2022-06-14 13:55:33 +04:00
parent 89f0c0974d
commit af9096df0c
2 changed files with 15 additions and 3 deletions

View File

@ -7,6 +7,7 @@ NAMES=(
package.html:javadoc-package
)
EXTS=(
lst:empty
txt:text
conf:conf
sql:sql
@ -50,7 +51,7 @@ TEMPLATES=(
# Scripts à utiliser pour générer les templates
TEMPLS=(
text:text conf:text sql:text sieve:text yaml:text
empty:text text:text conf:text sql:text sieve:text yaml:text
markdown:wiki tiddlywiki:wiki
puml:plantuml iuml:plantuml
shell:shell

View File

@ -23,9 +23,9 @@ OPTIONS
}
NAME=text
TEMPLATES=(text conf sql sieve yaml)
TEMPLATES=(empty text conf sql sieve yaml)
NAMES=()
EXTS=(txt conf sql sieve yml yaml)
EXTS=(lst txt conf sql sieve yml yaml)
if [ $# -eq 2 ]; then
if [ "$1" == "--matches-template" ]; then
@ -58,6 +58,16 @@ function check_overwrite() {
return 0
}
function generate_empty() {
local file="$1"
check_overwrite "$1" || return
estep "$(ppath "$file")"
touch "$file"
[ -n "$2" ] && array_add "$2" "$file"
return 0
}
function generate_text() {
local file="$1"
local mode=text
@ -150,6 +160,7 @@ for file in "$@"; do
fi
case "$t" in
empty) generate_empty "$file" files2edit || r=$?;;
text|txt|t) generate_text "$file" files2edit || r=$?;;
conf|c) generate_conf "$file" files2edit || r=$?;;
sql) generate_sql "$file" files2edit || r=$?;;