git_global/
subcommands.rs1pub mod ahead;
3pub mod info;
4pub mod install_manpage;
5pub mod list;
6pub mod scan;
7pub mod staged;
8pub mod stashed;
9pub mod status;
10pub mod unstaged;
11
12use crate::config::Config;
13use crate::errors::{GitGlobalError, Result};
14use crate::report::Report;
15
16pub fn run(maybe_subcmd: Option<&str>, config: Config) -> Result<Report> {
21 let command = maybe_subcmd.unwrap_or(&config.default_cmd);
22 match command {
23 "info" => info::execute(config),
24 "list" => list::execute(config),
25 "scan" => scan::execute(config),
26 "staged" => staged::execute(config),
27 "stashed" => stashed::execute(config),
28 "status" => status::execute(config),
29 "unstaged" => unstaged::execute(config),
30 "ahead" => ahead::execute(config),
31 "install-manpage" => install_manpage::execute(config),
32 cmd => Err(GitGlobalError::BadSubcommand(cmd.to_string())),
33 }
34}
35
36pub fn get_subcommands() -> Vec<(&'static str, &'static str)> {
40 vec![
41 (
42 "ahead",
43 "Shows repos with changes that are not pushed to a remote",
44 ),
45 ("info", "Shows meta-information about git-global"),
46 (
47 "install-manpage",
48 "Attempts to install git-global's man page",
49 ),
50 ("list", "Lists all known repos"),
51 ("scan", "Updates cache of known repos"),
52 (
53 "staged",
54 "Shows git index status for repos with staged changes",
55 ),
56 ("stashed", "Shows repos with stashed changes"),
57 (
58 "status",
59 "Shows status (`git status -s`) for repos with any changes",
60 ),
61 (
62 "unstaged",
63 "Shows working dir status for repos with unstaged changes",
64 ),
65 ]
66}