29 lines
711 B
Fish
Executable File
29 lines
711 B
Fish
Executable File
#!/usr/bin/env fish
|
|
#usage: add-page path/to/file.gmi
|
|
|
|
function convert_page
|
|
#set title via argv
|
|
set title (basename $argv .gmi)
|
|
echo "Converting $title page"
|
|
node geminut ~/public_gemini/$argv ~/public_html/$title.html
|
|
|
|
end
|
|
|
|
function convert_indexes
|
|
#recreate index, categories pages
|
|
echo "Rebuilding index page"
|
|
node geminut ~/public_gemini/index.gmi ~/public_html/index.html
|
|
echo "Rebuilding categories page"
|
|
node geminut ~/public_gemini/categories.gmi ~/public_html/categories.html
|
|
|
|
end
|
|
|
|
if test -d $argv
|
|
#no argument, so just rebuild index/categories pages
|
|
convert_indexes
|
|
exit
|
|
else
|
|
convert_page $argv
|
|
convert_indexes
|
|
end
|