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 6a8f869e5b.
embed
Manos Pitsidianakis 2019-10-24 12:19:29 +03:00
parent cde9eb43f5
commit 212e9bd701
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
4 changed files with 0 additions and 50 deletions

1
.gitignore vendored
View File

@ -6,4 +6,3 @@ target/
**/*.rs.bk
.gdb_history
*.log
src/manuals

View File

@ -3,7 +3,6 @@ name = "meli"
version = "0.3.2"
authors = ["Manos Pitsidianakis <el13635@mail.ntua.gr>"]
edition = "2018"
build = "build.rs"
[[bin]]
name = "meli"

6
meli.1
View File

@ -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:

View File

@ -81,8 +81,6 @@ struct CommandLineArguments {
config: Option<String>,
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()),