Changing clap settings (#624)

This commit is contained in:
Dylan Maccora 2018-02-18 18:10:47 +11:00 committed by Michael Bryan
parent 8a00a004d8
commit 38c883e1ef
1 changed files with 10 additions and 7 deletions

View File

@ -1,6 +1,6 @@
extern crate chrono;
#[macro_use]
extern crate clap;
extern crate chrono;
extern crate env_logger;
extern crate error_chain;
#[macro_use]
@ -38,7 +38,7 @@ fn main() {
.author("Mathieu David <mathieudavid@mathieudavid.org>")
// Get the version from our Cargo.toml using clap's crate_version!() macro
.version(concat!("v",crate_version!()))
.setting(AppSettings::SubcommandRequired)
.setting(AppSettings::ArgRequiredElseHelp)
.after_help("For more information about a specific command, \
try `mdbook <command> --help`\n\
Source code for mdbook available \
@ -77,11 +77,14 @@ fn init_logger() {
let mut builder = Builder::new();
builder.format(|formatter, record| {
writeln!(formatter, "{} [{}] ({}): {}",
Local::now().format("%Y-%m-%d %H:%M:%S"),
record.level(),
record.target(),
record.args())
writeln!(
formatter,
"{} [{}] ({}): {}",
Local::now().format("%Y-%m-%d %H:%M:%S"),
record.level(),
record.target(),
record.args()
)
});
if let Ok(var) = env::var("RUST_LOG") {