Skip to content

Commit

Permalink
chore: 补齐一波步骤的info打印
Browse files Browse the repository at this point in the history
  • Loading branch information
Cnotech committed Jul 20, 2024
1 parent f31721e commit 03ec44b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/types/steps/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ fn copy(
copy_dir(from, &to_path)?;
}

log!("Info(Copy):Copied '{from}' to '{to}'", to = p2s!(to_path));
Ok(())
}

Expand Down
1 change: 1 addition & 0 deletions src/types/steps/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fn delete(target: &String, force: bool) -> Result<()> {
Err(anyhow!("Error(Delete):Failed to delete '{target}' : '{e}', enable field 'force' to try shredding"))
}
} else {
log!("Log(Delete):Deleted '{target}' by moving to recycle bin");
Ok(())
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/types/steps/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,12 @@ impl TStep for StepLink {
HashSet::from_iter(self.at.clone().unwrap_or(vec!["Desktop".to_string()]));
if set.contains("Desktop") {
create_shortcut(&sl, &target_name, &env_desktop())?;
log!("Info(Link):Added shortcut '{target_name}' to desktop");
}
if set.contains("StartMenu") {
create_shortcut(&sl, &target_name, &env_start_menu())?;
update_start_menu();
log!("Info(Link):Added shortcut '{target_name}' to start menu");
}

Ok(0)
Expand Down
5 changes: 4 additions & 1 deletion src/types/steps/mv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ fn mv(
"Error:Failed to move file from '{from}' to '{to_str}' : {e}",
to_str = p2s!(to_path)
)
})
})?;

log!("Info(Move):Moved '{from}' to '{to}'", to = p2s!(to_path));
Ok(())
}

impl TStep for StepMove {
Expand Down
6 changes: 4 additions & 2 deletions src/types/steps/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ impl TStep for StepNew {

// 分流处理
if self.at.ends_with('/') {
new_dir(&self.at)?
new_dir(&self.at)?;
log!("Info(New):Created directory '{at}'", at = self.at);
} else {
new_file(&self.at)?
new_file(&self.at)?;
log!("Info(New):Created file '{at}'", at = self.at);
}

Ok(0)
Expand Down
6 changes: 6 additions & 0 deletions src/types/steps/toast.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::TStep;
use crate::log;
use crate::types::interpretable::Interpretable;
use crate::types::permissions::PermissionKey;
use crate::types::steps::Permission;
Expand Down Expand Up @@ -37,6 +38,11 @@ impl TStep for StepToast {
c = self.content
)
})?;
log!(
"Log(Toast):Sent toast with title : '{t}', content : '{c}'",
t = self.title,
c = self.content
);
Ok(0)
}
fn reverse_run(self, _: &mut WorkflowContext) -> Result<()> {
Expand Down
1 change: 1 addition & 0 deletions src/types/steps/wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl TStep for StepWait {
};
}
} else {
log!("Info(Wait):Start to wait for '{}' ms...", self.timeout);
sleep(d);
}
Ok(0)
Expand Down

0 comments on commit 03ec44b

Please sign in to comment.