import initialise try: import posts except: print("No posts database") initialise.initialise() try: import users except: print("No users database") initialise.initialise() import config import newpost import editpost import rebuild import sys # Command line arguments from datetime import datetime if len(sys.argv) > 1: for argument in sys.argv: if argument == "--help": print(''' If no argument is passed, glogger will ask for a username; if that user exists, it will as if you want to create a new post, or edit a post (TODO) --help Output this help text --rebuild Rewrite every static page in the site ''') exit() if argument == "--rebuild": rebuild.rebuild() exit() username = input("Username: ").lower() # Check if this user exists user_present = False for current_user in range(len(users.users)): if users.users[current_user] == username: user_present = True userID = current_user if user_present == True: print('''What do you want to do? 0. Create (N)ew post 1. (E)dit a post''') answer = input() if answer == 'N' or answer == '0': newpost.newpost(userID, username, datetime) if answer == 'E' or answer == '1': editpost.editpost(userID, datetime) else: print('Sorry, that account does not exist, If it should, please ask the webadmin to add this account')