From 212e9bd701ee51bb533ac5c7e1fd80bb3491f451 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Thu, 24 Oct 2019 12:19:29 +0300 Subject: [PATCH] Revert "Show manuals with command line arguments" Since this commit requires `mandoc` as a build dependency, it is removed for now until a better compromise is found. This reverts commit 6a8f869e5b9b80d7150f1aeb00a262601da9e143. --- .gitignore | 1 - Cargo.toml | 1 - meli.1 | 6 ------ src/bin.rs | 42 ------------------------------------------ 4 files changed, 50 deletions(-) diff --git a/.gitignore b/.gitignore index 3bd6f70da..8f5ed0573 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ target/ **/*.rs.bk .gdb_history *.log -src/manuals diff --git a/Cargo.toml b/Cargo.toml index 9418e520a..612060c66 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,6 @@ name = "meli" version = "0.3.2" authors = ["Manos Pitsidianakis "] edition = "2018" -build = "build.rs" [[bin]] name = "meli" diff --git a/meli.1 b/meli.1 index 6c50c3364..12bed547e 100644 --- a/meli.1 +++ b/meli.1 @@ -43,10 +43,6 @@ if given, or at .Pa $XDG_CONFIG_HOME/meli/config .It Fl -config Ar path Start meli with given configuration file. -.It Fl -manual -Show (this) manual for meli. -.It Fl -conf-manual -Show manual for meli configuration file. .El .Sh STARTING WITH meli When launched for the first time, meli will search for its configuration directory, @@ -284,8 +280,6 @@ catchall for general errors Specifies the editor to use .It Ev MELI_CONFIG Override the configuration file -.It Ev PAGER -Pager to use for command line help output. .El .Sh FILES meli uses the following parts of the XDG standard: diff --git a/src/bin.rs b/src/bin.rs index 73f554b73..8131d6e8c 100644 --- a/src/bin.rs +++ b/src/bin.rs @@ -81,8 +81,6 @@ struct CommandLineArguments { config: Option, help: bool, version: bool, - manual: bool, - conf_manual: bool, } fn main() -> std::result::Result<(), std::io::Error> { @@ -97,8 +95,6 @@ fn main() -> std::result::Result<(), std::io::Error> { config: None, help: false, version: false, - manual: false, - conf_manual: false, }; for i in std::env::args().skip(1) { @@ -123,12 +119,6 @@ fn main() -> std::result::Result<(), std::io::Error> { "--version" | "-v" => { args.version = true; } - "--manual" => { - args.manual = true; - } - "--conf-manual" => { - args.conf_manual = true; - } e => match prev { None => error_and_exit!("error: value without command {}", e), Some(CreateConfig) if args.create_config.is_none() => { @@ -154,8 +144,6 @@ fn main() -> std::result::Result<(), std::io::Error> { println!("\t--version, -v\t\tprint version and exit"); println!("\t--create-config[ PATH]\tCreate a sample configuration file with available configuration options. If PATH is not specified, meli will try to create it in $XDG_CONFIG_HOME/meli/config"); println!("\t--config PATH, -c PATH\tUse specified configuration file"); - println!("\t--manual\t\tshow manual for meli"); - println!("\t--conf-manual\t\tshow manual for meli configuration file"); std::process::exit(0); } @@ -164,36 +152,6 @@ fn main() -> std::result::Result<(), std::io::Error> { std::process::exit(0); } - if args.manual { - let man_contents = include_str!("manuals/meli.txt"); - let pager = option_env!("PAGER").unwrap_or("less"); - let (read_end, write_end) = nix::unistd::pipe() - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; - use std::os::unix::io::FromRawFd; - unsafe { std::fs::File::from_raw_fd(write_end) }.write_all(man_contents.as_bytes())?; - let mut handle = std::process::Command::new(pager) - .stdin(unsafe { std::process::Stdio::from_raw_fd(read_end) }) - .stdout(std::process::Stdio::inherit()) - .spawn()?; - handle.wait()?; - std::process::exit(0); - } - - if args.conf_manual { - let man_contents = include_str!("manuals/meli_conf.txt"); - let pager = option_env!("PAGER").unwrap_or("less"); - let (read_end, write_end) = nix::unistd::pipe() - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; - use std::os::unix::io::FromRawFd; - unsafe { std::fs::File::from_raw_fd(write_end) }.write_all(man_contents.as_bytes())?; - let mut handle = std::process::Command::new(pager) - .stdin(unsafe { std::process::Stdio::from_raw_fd(read_end) }) - .stdout(std::process::Stdio::inherit()) - .spawn()?; - handle.wait()?; - std::process::exit(0); - } - match prev { None => {} Some(CreateConfig) if args.create_config.is_none() => args.create_config = Some("".into()),