use file extension when posting with bb.sh post file.ext
but let users override it with `bb.sh post -html file.md`
This commit is contained in:
parent
555db3167f
commit
7d67da7b27
1 changed files with 4 additions and 2 deletions
6
bb.sh
6
bb.sh
|
@ -594,9 +594,11 @@ write_entry() {
|
|||
delete_includes
|
||||
exit
|
||||
fi
|
||||
# check if TMPFILE is markdown even though the user didn't specify it
|
||||
# guess format from TMPFILE
|
||||
extension="${TMPFILE##*.}"
|
||||
[[ "$extension" == "md" ]] && fmt="md"
|
||||
[[ "$extension" == "md" || "$extension" == "html" ]] && fmt="$extension"
|
||||
# but let user override it (`bb.sh post -html file.md`)
|
||||
[[ "$2" == "-html" ]] && fmt="html"
|
||||
else
|
||||
TMPFILE=".entry-$RANDOM.$fmt"
|
||||
echo -e "Title on this line\n" >> "$TMPFILE"
|
||||
|
|
Loading…
Reference in a new issue