Skip to main content

git_global/subcommands/
stashed.rs

1//! The `stashed` subcommand: shows stash list for all known repos with stashes
2
3use crate::config::Config;
4use crate::errors::Result;
5use crate::parallel::{default_parallelism, run_parallel};
6use crate::repo::Repo;
7use crate::report::Report;
8
9/// Runs the `stashed` subcommand.
10pub fn execute(mut config: Config) -> Result<Report> {
11    let repos = config.get_repos();
12    let mut report = Report::new(&repos);
13    report.pad_repo_output();
14
15    let results = run_parallel(repos, default_parallelism(), |repo| {
16        repo.get_stash_list()
17    });
18
19    for (path, stash) in results {
20        let repo = Repo::new(path);
21        for line in stash {
22            report.add_repo_message(&repo, line);
23        }
24    }
25
26    Ok(report)
27}