Skip to content

Commit

Permalink
feat: beautify output
Browse files Browse the repository at this point in the history
  • Loading branch information
mrxiaozhuox committed Nov 14, 2023
1 parent 2523165 commit 4d86049
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
rust-i18n = "2"
2 changes: 1 addition & 1 deletion locales/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
da: Efter du har kørt det, kan du få adgang til /login med standard brugernavn:zhangsan og adgangskode:123
6 changes: 6 additions & 0 deletions src/utils/create_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
12 changes: 7 additions & 5 deletions src/utils/print_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<S: AsRef<str>>(msg: S) {
Expand Down

0 comments on commit 4d86049

Please sign in to comment.