Updated creation script since i keep forgetting how to use this thing
This commit is contained in:
18
scripts/new-post.py
Normal file
18
scripts/new-post.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from pathlib import Path
|
||||
from subprocess import check_call
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) == 1:
|
||||
print('No title given!')
|
||||
sys.exit(1)
|
||||
title = ' '.join(sys.argv[1:])
|
||||
filename = title.lower().replace(' ', '-') + '.md'
|
||||
|
||||
# Creating the new base post
|
||||
target = Path(f'content/posts/{filename}')
|
||||
if target.is_file():
|
||||
print(f'File \'{target}\' already present, nothing to do')
|
||||
else:
|
||||
check_call(f'hugo new {target}'.split())
|
||||
|
||||
Reference in New Issue
Block a user