@smbcloud / cli / commits / e52ee3a

use color schemes

Seto Elkahfi committed Jun 11, 2025 at 15:50 UTC e52ee3a777f2cc3af92c6d5c73df3b03a87a7ee6
2 files changed +17 -9
crates/cli/src/project/runner.rs
+17 -5
@@ -1,4 +1,4 @@
1 -use crate::ui::{fail_message, fail_symbol, ruby_symbol, succeed_message, succeed_symbol};
1 +use crate::ui::{fail_message, fail_symbol, succeed_message, succeed_symbol};
2 use anyhow::{Ok, Result};
3 use spinners::Spinner;
4 use std::path::Path;
@@ -6,6 +6,7 @@ use std::path::Path;
6 pub(crate) enum Runner {
7 NodeJs,
8 Ruby,
9 + Swift,
10 }
11
12 pub(crate) async fn detect_runner() -> Result<Runner> {
@@ -17,21 +18,32 @@ pub(crate) async fn detect_runner() -> Result<Runner> {
18 if Path::new("package.json").exists() {
19 spinner.stop_and_persist(
20 &succeed_symbol(),
20 - succeed_message("Detected NodeJs runner"),
21 + succeed_message("NodeJs 🟩 runner detected"),
22 );
23 return Ok(Runner::NodeJs);
24 }
25 if Path::new("Gemfile").exists() {
26 spinner.stop_and_persist(
27 &succeed_symbol(),
27 - succeed_message(&format!("Detected Ruby {} runner", ruby_symbol())),
28 + succeed_message("Ruby 🟥 runner detected"),
29 );
30 return Ok(Runner::Ruby);
31 }
32 + if Path::new("Package.swift").exists() {
33 + spinner.stop_and_persist(
34 + &succeed_symbol(),
35 + succeed_message("Swift 🟧 runner detected"),
36 + );
37 + return Ok(Runner::Swift);
38 + }
39
40 spinner.stop_and_persist(
41 &fail_symbol(),
34 - fail_message("Could not detect project runner: no package.json or Gemfile found"),
42 + fail_message(
43 + "Could not detect project runner: no package.json, Gemfile, or Package.swift found",
44 + ),
45 + );
46 + anyhow::bail!(
47 + "Could not detect project runner: no package.json, Gemfile, or Package.swift found"
48 );
36 - anyhow::bail!("Could not detect project runner: no package.json or Gemfile found");
49 }
crates/cli/src/ui/mod.rs
-4
@@ -8,10 +8,6 @@ pub fn fail_symbol() -> String {
8 style("✘").for_stderr().red().to_string()
9 }
10
11 -pub fn ruby_symbol() -> String {
12 - style("💎").red().to_string()
13 -}
14 -
11 pub fn succeed_message(message: &str) -> String {
12 style(message).white().to_string()
13 }