@smbcloud / cli / commits / 7037917

use repo

Seto Elkahfi committed May 28, 2025 at 21:10 UTC 70379174647134a8b8b1ea44f0bc581ceafe98c7
2 files changed +12 -8
crates/cli/src/deploy/config.rs
+11 -7
@@ -22,14 +22,18 @@ pub(crate) async fn check_config() -> Result<Config, ConfigError> {
22 }
23
24 // Parse toml file
25 - let config_content = fs::read_to_string(config_path).map_err(|_| ConfigError::MissingConfig)?;
25 + let config_content = fs::read_to_string(config_path)
26 + .map_err(|_| {
27 + ConfigError::MissingConfig
28 + })?;
29
30 let config: Config = match toml::from_str(&config_content) {
31 Ok(value) => value,
29 - Err(_) => {
32 + Err(e) => {
33 + println!("{}", e);
34 spinner.stop_and_persist(&fail_symbol(), fail_message("Config unsync."));
35 handle_config_error()?
32 - }
36 + },
37 };
38
39 spinner.stop_and_persist(&succeed_symbol(), succeed_message("Valid config."));
@@ -37,15 +41,15 @@ pub(crate) async fn check_config() -> Result<Config, ConfigError> {
41 Ok(config)
42 }
43
40 -fn handle_config_error() -> Result<Config, ConfigError> {
41 - todo!()
44 +fn handle_config_error() -> Result<Config, ConfigError> {
45 + todo!()
46 }
47
48 #[derive(Deserialize)]
49 pub struct Config {
50 pub name: String,
51 pub description: String,
48 - pub repository: Repository,
52 + pub repository: Repository
53 }
54
55 #[derive(Deserialize)]
@@ -68,7 +72,7 @@ impl Config {
72 let home = dirs::home_dir().expect("Could not determine home directory");
73 let key_path = home
74 .join(".ssh")
71 - .join(format!("id_{}@smbcloud.xyz", self.name));
75 + .join(format!("id_{}@smbcloud.xyz", self.repository.name));
76 let key_path_str = key_path.to_string_lossy().to_string();
77 println!("Use key path: {}", key_path_str);
78 key_path_str
crates/cli/src/deploy/mod.rs
+1 -1
@@ -41,7 +41,7 @@ pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
41 }
42 };
43
44 - let mut origin = remote_deployment_setup(&repo, &config.name).await?;
44 + let mut origin = remote_deployment_setup(&repo, &config.repository.name).await?;
45
46 let mut push_opts = PushOptions::new();
47 let mut callbacks = RemoteCallbacks::new();