pub mod ahead;
pub mod info;
pub mod install_manpage;
pub mod list;
pub mod scan;
pub mod staged;
pub mod stashed;
pub mod status;
pub mod unstaged;
use crate::config::Config;
use crate::errors::{GitGlobalError, Result};
use crate::report::Report;
pub fn run(maybe_subcmd: Option<&str>, config: Config) -> Result<Report> {
let command = maybe_subcmd.unwrap_or(&config.default_cmd);
match command {
"info" => info::execute(config),
"list" => list::execute(config),
"scan" => scan::execute(config),
"staged" => staged::execute(config),
"stashed" => stashed::execute(config),
"status" => status::execute(config),
"unstaged" => unstaged::execute(config),
"ahead" => ahead::execute(config),
"install-manpage" => install_manpage::execute(config),
cmd => Err(GitGlobalError::BadSubcommand(cmd.to_string())),
}
}
pub fn get_subcommands() -> Vec<(&'static str, &'static str)> {
vec![
(
"ahead",
"Shows repos with changes that are not pushed to a remote",
),
("info", "Shows meta-information about git-global"),
(
"install-manpage",
"Attempts to install git-global's man page",
),
("list", "Lists all known repos"),
("scan", "Updates cache of known repos"),
(
"staged",
"Shows git index status for repos with staged changes",
),
("stashed", "Shows repos with stashed changes"),
(
"status",
"Shows status (`git status -s`) for repos with any changes",
),
(
"unstaged",
"Shows working dir status for repos with unstaged changes",
),
]
}