Include the man page in the binary.
//! Configuration.
-use std::{env, fs, process};
+use std::{env, fs, io, process};
use std::io::Write;
use std::net::{SocketAddr, ToSocketAddrs};
use std::path::{Path, PathBuf};
@@ -164,8 +164,18 @@ impl Config {
.multiple(true)
.help("print more (and more) information")
)
+ .arg(Arg::with_name("man")
+ .long("man")
+ .help("print the man page to stdout")
+ )
.get_matches();
+ if matches.is_present("man") {
+ let stdout = io::stdout();
+ let _ = stdout.lock().write_all(MAN_PAGE);
+ process::exit(0);
+ }
+
let cur_dir = match env::current_dir() {
Ok(dir) => dir,
Err(err) => {
@@ -387,3 +397,8 @@ const DEFAULT_TALS: [(&str, &[u8]); 5] = [
("ripe.tal", include_bytes!("../tals/ripe.tal")),
];
+
+//------------ The Man Page --------------------------------------------------
+
+const MAN_PAGE: &[u8] = include_bytes!("../doc/routinator.1");
+
