git_global/subcommands/
install_manpage.rs

1//! The `install-manpage` subcommand: attempts to install a man page.
2
3use crate::config::Config;
4use crate::errors::Result;
5use crate::report::Report;
6
7// TODO(peap): Add option to just generate the file for the user to stick somewhere?
8
9/// Attempts to install git-global's man page to the relevant directory.
10/// This is a work-around to not maintaining distribution-specific packages
11/// and Cargo not providing this functionality for crates.
12pub fn execute(mut config: Config) -> Result<Report> {
13    let repos = config.get_repos();
14    let mut report = Report::new(&repos);
15    report.add_message("This feature is a work-in-progress.".to_string());
16    report.add_message(
17        "In the meantime, you can find the manpage at \
18         https://raw.githubusercontent.com/peap/git-global/master/doc/git-global.1".to_string()
19    );
20    if let Some(manpage_file) = config.manpage_file {
21        report.add_message(format!(
22            "...would write file to {}",
23            manpage_file.display()
24        ));
25    } else {
26        report.add_message("...not sure where to put it!".to_string());
27    }
28    Ok(report)
29}