2021-09-04 01:34:53 -04:00
|
|
|
import click
|
|
|
|
|
2021-09-11 12:52:33 -04:00
|
|
|
from .database import create as db_create, pwreset as db_pwreset, delete as db_delete
|
2021-09-10 01:39:46 -04:00
|
|
|
|
2021-09-04 01:34:53 -04:00
|
|
|
|
|
|
|
@click.group(short_help='Perform operations on MySQL')
|
|
|
|
def mysql():
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
@mysql.command(short_help='Create a MySQL database for a user')
|
|
|
|
@click.argument('username')
|
|
|
|
def create(username):
|
2021-09-11 12:52:33 -04:00
|
|
|
db_create(username, 'mysql')
|
2021-09-04 01:34:53 -04:00
|
|
|
|
|
|
|
|
|
|
|
@mysql.command(short_help='Reset the password of a MySQL user')
|
|
|
|
@click.argument('username')
|
|
|
|
def pwreset(username):
|
2021-09-11 12:52:33 -04:00
|
|
|
db_pwreset(username, 'mysql')
|
2021-09-04 01:34:53 -04:00
|
|
|
|
2021-09-10 01:39:46 -04:00
|
|
|
|
|
|
|
@mysql.command(short_help="Delete the database of a MySQL user")
|
|
|
|
@click.argument('username')
|
|
|
|
def delete(username):
|
2021-09-11 12:52:33 -04:00
|
|
|
db_delete(username, 'mysql')
|