32 lines
792 B
Markdown
32 lines
792 B
Markdown
|
#!/bin/bash
|
||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||
|
source /etc/nulib.sh || exit 1
|
||
|
|
||
|
: ${EDITOR:=vim}
|
||
|
|
||
|
args=(
|
||
|
"créer un nouveau fichier .markdown"
|
||
|
"<files...>"
|
||
|
)
|
||
|
parse_args "$@"; set -- "${args[@]}"
|
||
|
|
||
|
[ $# -gt 0 ] || die "vous devez spécifier les noms des fichiers à créer"
|
||
|
|
||
|
for file in "$@"; do
|
||
|
setx filename=basename "$file"
|
||
|
if [[ "$filename" == *.* ]]; then
|
||
|
: # y'a une extension, ne rien faire
|
||
|
elif [ -f "$file.markdown" ]; then
|
||
|
file="$file.markdown"
|
||
|
else
|
||
|
file="$file.md"
|
||
|
fi
|
||
|
[ -e "$file" ] && die "$file: fichier existant"
|
||
|
estep "Création de $file"
|
||
|
echo -n >"$file" "\
|
||
|
|
||
|
|
||
|
-*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary"
|
||
|
"$EDITOR" "$file"
|
||
|
done
|