diff --git a/gempost b/gempost index 05f956e..c471775 100755 --- a/gempost +++ b/gempost @@ -332,6 +332,12 @@ elif (arg == "purge"): # permanently delete trashed posts elif (arg == "init"): # initialize public_gemini/ for use with gempost if (len(listdir(f"{wdir}")) <= 2): exec(f"touch {wdir}postIndex && mkdir {wdir}postdir/ {wdir}trash/ && chmod 745 {wdir}* && chmod 700 {wdir}trash/") + ch = input("Also create index.gmi ? (y/[n]) ") + if (ch == 'y' or ch == 'Y'): + index_init = [f"# {getlogin()}'s page\n", "\nThis is your homepage. You can customize it however you want by editing this file.\n", "\nJust remember keeping around the link below to point your visitors to your posts!\n", "\n=> ./posts.gmi Posts"] + exec(f"touch {wdir}index.gmi") + with open(f"{wdir}index.gmi", 'w') as i: + i.writelines(index_init) prGreen('Done. Use "gempost help" to view available arguments.') else: prRed('Only your "index.gmi" (and optionally "postPageHeader.gmi") should be there in public_gemini/') @@ -341,6 +347,12 @@ elif (arg == "reset"): # delete all posts and re-initialize public_gemini/ for u if (input('Type "yes, I understand" to continue: ') == "yes, I understand"): exec(f"rm -rf {wdir}postdir/ {wdir}trash/ && rm -f {wdir}posts.gmi {indexFile}") exec(f"touch {wdir}postIndex && mkdir {wdir}postdir/ {wdir}trash/ && chmod 745 {wdir}* && chmod 700 {wdir}trash/") + ch = input("Also create index.gmi ? (y/[n]) ") + if (ch == 'y' or ch == 'Y'): + index_init = [f"# {getlogin()}'s page\n", "\nThis is your homepage. You can customize it however you want by editing this file.\n", "\nJust remember keeping around the link below to point your visitors to your posts!\n", "\n=> ./posts.gmi Posts"] + exec(f"touch {wdir}index.gmi") + with open(f"{wdir}index.gmi", 'w') as i: + i.writelines(index_init) prYellow("public_gemini/ has been re-initialized successfully.") else: print("Cancelled.")