use.rs
1use anyhow::Result;
2
3pub fn run(name: &str, json: bool) -> Result<()> {
4 let cwd = std::env::current_dir()?;
5 crate::db::use_project(&cwd, name)?;
6
7 if json {
8 println!(
9 "{}",
10 serde_json::json!({"success": true, "project": name, "bound_path": cwd})
11 );
12 } else {
13 let c = crate::color::stdout_theme();
14 println!("{}bound{} {} -> {name}", c.green, c.reset, cwd.display());
15 }
16
17 Ok(())
18}