From 4d860495611c4f2a25c07a8c049002e758a1f4be Mon Sep 17 00:00:00 2001 From: YuKun Liu Date: Mon, 13 Nov 2023 21:33:37 -0800 Subject: [PATCH] feat: beautify output --- Cargo.toml | 6 +++++- locales/app.yml | 2 +- src/utils/create_project.rs | 6 ++++++ src/utils/print_util.rs | 12 +++++++----- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7ef08df..bd376ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,10 @@ license = "MIT/Apache-2.0" repository = "https://github.com/fankaiLiu/salvo-cli" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[[bin]] +name = "salvo" +path = "src/main.rs" + [dependencies] ansi_term = "0.12.1" anyhow = "1.0.75" @@ -19,4 +23,4 @@ handlebars = "4.4.0" serde = { version = "1.0.188", features = ["derive"] } serde_json = "1.0.107" unicode-xid = "0.2.4" -rust-i18n = "2" \ No newline at end of file +rust-i18n = "2" diff --git a/locales/app.yml b/locales/app.yml index abe087a..b59d976 100644 --- a/locales/app.yml +++ b/locales/app.yml @@ -418,4 +418,4 @@ access_instructions: uk: Після його запуску Ви можете отримати доступ до /login за допомогою стандартного імені користувача:zhangsan та пароля:123 th: หลังจากทำการรันแล้ว คุณสามารถเข้าถึง /login ด้วยชื่อผู้ใช้งานเริ่มต้น:zhangsan และรหัสผ่าน:123 el: Αφού το τρέξετε, μπορείτε να προσπελάσετε το /login με το προεπιλεγμένο όνομα χρήστη:zhangsan και τον κωδικό πρόσβασης:123 - da: Efter du har kørt det, kan du få adgang til /login med standard brugernavn:zhangsan og adgangskode:123 \ No newline at end of file + da: Efter du har kørt det, kan du få adgang til /login med standard brugernavn:zhangsan og adgangskode:123 diff --git a/src/utils/create_project.rs b/src/utils/create_project.rs index 743ac3b..974b391 100644 --- a/src/utils/create_project.rs +++ b/src/utils/create_project.rs @@ -45,7 +45,13 @@ pub fn create_project(project: Project) -> Result<()> { } fn after_print_info(project_name: &String, config: UserSelected) { + println!(); // a new line + + // print success info success(t!("create_success", project_name = project_name).replace(r"\n", "\n")); + + println!(); // a new line + match config.db_conn_type { DbConnectionType::Sqlx => { success(t!("create_success_sqlx").replace(r"\n", "\n")); diff --git a/src/utils/print_util.rs b/src/utils/print_util.rs index b996462..9faf894 100644 --- a/src/utils/print_util.rs +++ b/src/utils/print_util.rs @@ -2,17 +2,19 @@ use ansi_term::Colour::{Blue, Green, Red, Yellow}; pub fn print_logo() { let art = r" - _______________________ ________ ______________________ - __ ___/__ |__ /__ | / /_ __ \ __ ____/__ /____ _/ - _____ \__ /| |_ / __ | / /_ / / / _ / __ / __ / - ____/ /_ ___ | /____ |/ / / /_/ / / /___ _ /____/ / - /____/ /_/ |_/_____/____/ \____/ \____/ /_____/___/ + ____ _ _ __ _____ ____ _ ___ + / ___| / \ | |\ \ / / _ \ / ___| | |_ _| + \___ \ / _ \ | | \ \ / / | | | | | | | | | + ___) / ___ \| |__\ V /| |_| | | |___| |___ | | + |____/_/ \_\_____\_/ \___/ \____|_____|___| + "; let lines = art.lines(); for line in lines { let (part_blue, part_green) = line.split_at(line.len() / 2); println!("{}{}", Blue.paint(part_blue), Green.paint(part_green)); } + println!(); // a new line } pub fn warning>(msg: S) {