flatten subcommands and add better doc comments
This commit is contained in:
25
src/main.rs
25
src/main.rs
@@ -15,28 +15,27 @@ struct Args {
|
||||
command: Command,
|
||||
|
||||
#[command(flatten)]
|
||||
config_overrides: core::config::ConfigOverrideArgs,
|
||||
config_overrides: core::config::GlobalConfigArgs,
|
||||
|
||||
#[cfg(feature = "tui")]
|
||||
#[arg(short, long, alias = "tui", global = true)]
|
||||
interactive: bool,
|
||||
}
|
||||
|
||||
/// Database administration tool designed for non-admin users to manage their own MySQL databases and users.
|
||||
/// Use `--help` for advanced usage.
|
||||
/// Database administration tool for non-admin users to manage their own MySQL databases and users.
|
||||
///
|
||||
/// This tool allows you to manage users and databases in MySQL that are prefixed with your username.
|
||||
/// This tool allows you to manage users and databases in MySQL.
|
||||
///
|
||||
/// You are only allowed to manage databases and users that are prefixed with
|
||||
/// either your username, or a group that you are a member of.
|
||||
#[derive(Parser)]
|
||||
#[command(version, about, disable_help_subcommand = true)]
|
||||
enum Command {
|
||||
/// Create, drop or show/edit permissions for DATABASE(s),
|
||||
#[command(alias = "database")]
|
||||
Db(cli::database_command::DatabaseArgs),
|
||||
#[command(flatten)]
|
||||
Db(cli::database_command::DatabaseCommand),
|
||||
|
||||
// Database(cli::database_command::DatabaseArgs),
|
||||
/// Create, drop, change password for, or show your USER(s),
|
||||
#[command(name = "user")]
|
||||
User(cli::user_command::UserArgs),
|
||||
#[command(flatten)]
|
||||
User(cli::user_command::UserCommand),
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
@@ -47,9 +46,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
let connection = core::config::mysql_connection_from_config(config).await?;
|
||||
|
||||
match args.command {
|
||||
Command::Db(database_args) => {
|
||||
cli::database_command::handle_command(database_args, connection).await
|
||||
}
|
||||
Command::Db(command) => cli::database_command::handle_command(command, connection).await,
|
||||
Command::User(user_args) => cli::user_command::handle_command(user_args, connection).await,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user