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