cleaner
This commit is contained in:
@@ -23,8 +23,7 @@ is_true() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if file is empty
|
# if file is empty
|
||||||
content=$(cat "$file_path")
|
if [ -z "$(cat "$file_path")" ]; then
|
||||||
if [ -z "$content" ]; then
|
|
||||||
echo -e "---\n" >"$file_path"
|
echo -e "---\n" >"$file_path"
|
||||||
echo -e "---\n" >>"$file_path"
|
echo -e "---\n" >>"$file_path"
|
||||||
fi
|
fi
|
||||||
@@ -32,9 +31,8 @@ fi
|
|||||||
echo "Checking front matter"
|
echo "Checking front matter"
|
||||||
if ! grep -q "^---$" "$file_path"; then
|
if ! grep -q "^---$" "$file_path"; then
|
||||||
echo "Front matter (start) not found, adding it"
|
echo "Front matter (start) not found, adding it"
|
||||||
content=$(cat "$file_path")
|
|
||||||
echo -e "---\n" >"$file_path"
|
echo -e "---\n" >"$file_path"
|
||||||
echo "$content" >>"$file_path"
|
echo "$(cat "$file_path")" >>"$file_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the title from the front matter
|
# Get the title from the front matter
|
||||||
|
|||||||
Reference in New Issue
Block a user