|
|
|
@ -4,9 +4,18 @@ import mysql from 'mysql2/promise'
|
|
|
|
|
import { input, password } from '@inquirer/prompts'
|
|
|
|
|
import generator from 'generate-password'
|
|
|
|
|
import chalk from 'chalk'
|
|
|
|
|
import { program } from 'commander'
|
|
|
|
|
|
|
|
|
|
const log = console.log
|
|
|
|
|
|
|
|
|
|
program
|
|
|
|
|
.option('-u, --user', 'User')
|
|
|
|
|
|
|
|
|
|
program.parse(process.argv)
|
|
|
|
|
|
|
|
|
|
// getting options
|
|
|
|
|
const options = program.opts()
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* mariadb-drop.js
|
|
|
|
|
*
|
|
|
|
@ -19,6 +28,10 @@ const user = {
|
|
|
|
|
password: undefined
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (options.user) {
|
|
|
|
|
user.name = options.user
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log(chalk.red('Mariadb Create Database...'))
|
|
|
|
|
|
|
|
|
|
user.password = await password({
|
|
|
|
|