mirror of
https://github.com/morgan9e/blog
synced 2026-04-15 00:34:35 +09:00
Reset
This commit is contained in:
21
scripts/new.sh
Executable file
21
scripts/new.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
TITLE="changeme"
|
||||
DATE=$(date +%Y-%m-%d)
|
||||
FILE="$DATE-$TITLE.md"
|
||||
|
||||
if [ ! -f content/posts/$FILE ]; then
|
||||
echo Creating new file $FILE
|
||||
cp content/posts/2000-01-01-draft.md content/posts/$FILE
|
||||
sed -i "s/date = 2000-01-01T00:00:00Z/date = $(date -Isec)/g" content/posts/$FILE
|
||||
fi
|
||||
|
||||
if [ $( command -v subl ) ]; then
|
||||
subl $FILE
|
||||
elif [ $( command -v gedit ) ]; then
|
||||
gedit $FILE
|
||||
elif [ $( command -v vim ) ]; then
|
||||
vim $FILE
|
||||
else
|
||||
$EDITOR $FILE
|
||||
fi
|
||||
Reference in New Issue
Block a user