workspacer_cli/
format_all_imports.rs1crate::ix!();
3
4#[derive(Debug, StructOpt)]
6pub struct FormatAllImportsCommand {
7 #[structopt(long = "path")]
9 workspace_path: Option<PathBuf>,
10
11 #[structopt(long = "skip-git-check")]
13 skip_git_check: bool,
14}
15
16impl FormatAllImportsCommand {
17 pub async fn run(&self) -> Result<(), WorkspaceError> {
18 let ws_path = self.workspace_path.clone();
19 let skip_flag = self.skip_git_check;
20
21 run_with_workspace(ws_path, skip_flag, move |ws| {
23 Box::pin(async move {
24 ws.sort_and_format_imports().await.map_err(|err| {
26 error!("Failed to format imports in entire workspace: {:?}", err);
27 err
28 })?;
29
30 info!("Successfully formatted imports in the entire workspace!");
31 Ok(())
32 })
33 })
34 .await
35 }
36}