#!/usr/bin/env python from getpass import getpass import click from models import User as NewUser from models import Faccet, Post from models import db as database from models import generate_password_hash first_post = """ # Welcome to vibes Vibes is journaling based forum software. Built for intentional communities and people. Have fun and be safe """ post_subject = "Welcome" bio_default = "They've been chilling in the basement for a minute" @click.group() def cli(): pass @cli.command def install(): database.create_tables([NewUser, Post, Faccet]) username = click.prompt("Enter a user account name:", default="user", type=str) profile_name = click.prompt("Enter a profile name:", default="enzo", type=str) usr = None passwd = getpass(f"Enter password for {username}: ") confirm = getpass("Confirm: ") if passwd != confirm: click.echo("password mismatch") return 1 hashed = generate_password_hash(passwd) with database: usr = NewUser.create( username=username, default_faccet=profile_name, password_hash=hashed ) profile = Faccet.create(user_belongs=usr, name=profile_name, bio=bio_default) Post.create(authour=profile, parent=0, title=post_subject, content=first_post) styled = click.style("It worked boot up the app", bold=True, fg="green") click.echo(styled) if __name__ == "__main__": cli()