1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
//! The `scan` subcommand: scans the filesystem for git repos. //! //! By default, the user's home directory is walked, but this starting point can //! be configured in `~/.gitconfig`: //! //! ```bash //! $ git config --global global.basedir /some/path //! ``` //! //! The `scan` subcommand caches the list of git repos paths it finds, and can //! be rerun at any time to refresh the list. use config::Config; use errors::Result; use report::Report; /// Clears the cache, forces a rescan, and says how many repos were found. pub fn execute(mut config: Config) -> Result<Report> { config.clear_cache(); let repos = config.get_repos(); let mut report = Report::new(&repos); report.add_message(format!( "Found {} repos. Use `git global list` to show them.", repos.len() )); Ok(report) }