Skip to content

Commit

Permalink
Merge pull request #9 from mrxiaozhuox/main
Browse files Browse the repository at this point in the history
beautify output
  • Loading branch information
fankaiLiu authored Nov 14, 2023
2 parents 2523165 + 8834fd4 commit 1869674
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 25 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"
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,58 +30,58 @@ To create a new Salvo project, use the new command followed by the name of your

```bash
//use the local language
salvo-cli new project_name
salvo new project_name

// Use English
salvo-cli new project_name --lang=en
salvo new project_name --lang=en

// 使用简体中文
salvo-cli new project_name --lang=zh
salvo new project_name --lang=zh

// 使用繁體中文
salvo-cli new project_name --lang=zh_TW
salvo new project_name --lang=zh_TW

// Utilisez le français
salvo-cli new project_name --lang=fr
salvo new project_name --lang=fr

// 日本語を使用する
salvo-cli new project_name --lang=ja
salvo new project_name --lang=ja

// Usa el español
salvo-cli new project_name --lang=es
salvo new project_name --lang=es

// Verwenden Sie Deutsch
salvo-cli new project_name --lang=de
salvo new project_name --lang=de

// Используйте русский
salvo-cli new project_name --lang=ru
salvo new project_name --lang=ru

// Usa l `italiano
salvo-cli new project_name --lang=it
salvo new project_name --lang=it
// Use o português
salvo-cli new project_name --lang=pt
salvo new project_name --lang=pt
// 한국어를 사용하십시오
salvo-cli new project_name --lang=ko
salvo new project_name --lang=ko
// Bruk norsk
salvo-cli new project_name --lang=no
salvo new project_name --lang=no
// Notaðu íslensku
salvo-cli new project_name --lang=is
salvo new project_name --lang=is
// Використовуйте українську
salvo-cli new project_name --lang=uk
salvo new project_name --lang=uk
// ใช้ภาษาไทย
salvo-cli new project_name --lang=th
salvo new project_name --lang=th
// Χρησιμοποιήστε την ελληνική
salvo-cli new project_name --lang=el
salvo new project_name --lang=el
// Brug dansk
salvo-cli new project_name --lang=da
salvo new project_name --lang=da
```

## Update
Expand Down
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 1869674

Please sign in to comment.