From 9fbfd066639ab67388c0f3d4025bf6bc58c4844e Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Fri, 27 Jan 2023 12:44:40 +0800 Subject: [PATCH] [CLI] a warm welcome message included :) (#1417) * [CLI] a warm welcome message included :) * Update layout * update layout --- sea-orm-cli/Cargo.toml | 5 ++- sea-orm-cli/src/cli.rs | 74 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 65 insertions(+), 14 deletions(-) diff --git a/sea-orm-cli/Cargo.toml b/sea-orm-cli/Cargo.toml index 02d48d68..c8cabf22 100644 --- a/sea-orm-cli/Cargo.toml +++ b/sea-orm-cli/Cargo.toml @@ -4,7 +4,10 @@ [package] name = "sea-orm-cli" version = "0.10.3" -authors = ["Billy Chan "] +authors = [ + "Chris Tsang ", + "Billy Chan ", +] edition = "2021" description = "Command line utility for SeaORM" license = "MIT OR Apache-2.0" diff --git a/sea-orm-cli/src/cli.rs b/sea-orm-cli/src/cli.rs index eafb433a..a7a2e0e7 100644 --- a/sea-orm-cli/src/cli.rs +++ b/sea-orm-cli/src/cli.rs @@ -1,7 +1,41 @@ use clap::{ArgEnum, ArgGroup, Parser, Subcommand}; #[derive(Parser, Debug)] -#[clap(version)] +#[clap( + version, + author, + help_template = r#"{before-help}{name} {version} +{about-with-newline} + +{usage-heading} {usage} + +{all-args}{after-help} + +AUTHORS: + {author} +"#, + about = r#" + ____ ___ ____ __ __ /\ + / ___| ___ __ _ / _ \ | _ \ | \/ | {.-} + \___ \ / _ \ / _` || | | || |_) || |\/| | ;_.-'\ + ___) || __/| (_| || |_| || _ < | | | | { _.}_ + |____/ \___| \__,_| \___/ |_| \_\|_| |_| \.-' / `, + \ | / + An async & dynamic ORM for Rust \ | ,/ + =============================== \|_/ + + Getting Started! + - documentation: https://www.sea-ql.org/SeaORM + - step-by-step tutorials: https://www.sea-ql.org/sea-orm-tutorial + - integration examples: https://github.com/SeaQL/sea-orm/tree/master/examples + - cookbook: https://www.sea-ql.org/sea-orm-cookbook + + Join our Discord server to chat with others in the SeaQL community! + - invitation link: https://discord.com/invite/uCPdDXzbdv + + If you like what we do, consider starring, commenting, sharing and contributing! +"# +)] pub struct Cli { #[clap(action, global = true, short, long, help = "Show debug messages")] pub verbose: bool, @@ -12,13 +46,16 @@ pub struct Cli { #[derive(Subcommand, PartialEq, Eq, Debug)] pub enum Commands { - #[clap(about = "Codegen related commands")] - #[clap(arg_required_else_help = true)] + #[clap( + about = "Codegen related commands", + arg_required_else_help = true, + display_order = 10 + )] Generate { #[clap(subcommand)] command: GenerateSubcommands, }, - #[clap(about = "Migration related commands")] + #[clap(about = "Migration related commands", display_order = 20)] Migrate { #[clap( value_parser, @@ -63,9 +100,9 @@ you should provide the directory of that submodule.", #[derive(Subcommand, PartialEq, Eq, Debug)] pub enum MigrateSubcommands { - #[clap(about = "Initialize migration directory")] + #[clap(about = "Initialize migration directory", display_order = 10)] Init, - #[clap(about = "Generate a new, empty migration")] + #[clap(about = "Generate a new, empty migration", display_order = 20)] Generate { #[clap( value_parser, @@ -82,15 +119,21 @@ pub enum MigrateSubcommands { )] universal_time: bool, }, - #[clap(about = "Drop all tables from the database, then reapply all migrations")] + #[clap( + about = "Drop all tables from the database, then reapply all migrations", + display_order = 30 + )] Fresh, - #[clap(about = "Rollback all applied migrations, then reapply all migrations")] + #[clap( + about = "Rollback all applied migrations, then reapply all migrations", + display_order = 40 + )] Refresh, - #[clap(about = "Rollback all applied migrations")] + #[clap(about = "Rollback all applied migrations", display_order = 50)] Reset, - #[clap(about = "Check the status of all migrations")] + #[clap(about = "Check the status of all migrations", display_order = 60)] Status, - #[clap(about = "Apply pending migrations")] + #[clap(about = "Apply pending migrations", display_order = 70)] Up { #[clap( value_parser, @@ -100,14 +143,19 @@ pub enum MigrateSubcommands { )] num: Option, }, - #[clap(value_parser, about = "Rollback applied migrations")] + #[clap( + value_parser, + about = "Rollback applied migrations", + display_order = 80 + )] Down { #[clap( value_parser, short, long, default_value = "1", - help = "Number of applied migrations to be rolled back" + help = "Number of applied migrations to be rolled back", + display_order = 90 )] num: u32, },