From 59bcd856628cdd9f76893ee2e92ac465b9c62784 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Mon, 16 Mar 2015 20:56:42 +0100 Subject: [PATCH] Improve formatting for README, remove some tabs --- README.md | 110 ++++++++++++++++++++++++++--------------------------- src/lib.rs | 28 +++++++------- 2 files changed, 69 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index d2725599..a1cfe322 100644 --- a/README.md +++ b/README.md @@ -19,53 +19,53 @@ extern crate clap; use clap::{Arg, App, SubCommand}; fn main() { - let matches = App::new("MyApp") - .version("1.0") - .author("Kevin K. ") - .about("Does awesome things") - .arg(Arg::new("config") - .short("c") - .long("config") - .help("Sets a custom config file") - .takes_value(true)) - .arg(Arg::new("output") - .help("Sets an optional output file") - .index(1)) - .arg(Arg::new("debug") - .short("d") - .multiple(true) - .help("Turn debugging information on")) - .subcommand(SubCommand::new("test") - .about("controls testing features") - .arg(Arg::new("verbose") - .short("v") - .help("print test information verbosely"))) - .get_matches(); - - if let Some(o) = matches.value_of("output") { - println!("Value for output: {}", o); - } - - if let Some(c) = matches.value_of("config") { - println!("Value for config: {}", c); - } - - match matches.occurrences_of("debug") { - 0 => println!("Debug mode is off"), - 1 => println!("Debug mode is kind of on"), - 2 => println!("Debug mode is on"), - 3 | _ => println!("Don't be crazy"), - } - - if let Some(ref matches) = matches.subcommand_matches("test") { - if matches.is_present("list") { - println!("Printing testing lists..."); - } else { - println!("Not printing testing lists..."); - } - } - - // more porgram logic goes here... + let matches = App::new("MyApp") + .version("1.0") + .author("Kevin K. ") + .about("Does awesome things") + .arg(Arg::new("config") + .short("c") + .long("config") + .help("Sets a custom config file") + .takes_value(true)) + .arg(Arg::new("output") + .help("Sets an optional output file") + .index(1)) + .arg(Arg::new("debug") + .short("d") + .multiple(true) + .help("Turn debugging information on")) + .subcommand(SubCommand::new("test") + .about("controls testing features") + .arg(Arg::new("verbose") + .short("v") + .help("print test information verbosely"))) + .get_matches(); + + if let Some(o) = matches.value_of("output") { + println!("Value for output: {}", o); + } + + if let Some(c) = matches.value_of("config") { + println!("Value for config: {}", c); + } + + match matches.occurrences_of("debug") { + 0 => println!("Debug mode is off"), + 1 => println!("Debug mode is kind of on"), + 2 => println!("Debug mode is on"), + 3 | _ => println!("Don't be crazy"), + } + + if let Some(ref matches) = matches.subcommand_matches("test") { + if matches.is_present("list") { + println!("Printing testing lists..."); + } else { + println!("Not printing testing lists..."); + } + } + + // more porgram logic goes here... } ``` @@ -78,22 +78,22 @@ Kevin K. Does awesome things USAGE: - MyApp [FLAGS] [OPTIONS] [POSITIONAL] [SUBCOMMANDS] + MyApp [FLAGS] [OPTIONS] [POSITIONAL] [SUBCOMMANDS] FLAGS: - -d Turn debugging information on - -h,--help Prints this message - -v,--version Prints version information + -d Turn debugging information on + -h,--help Prints this message + -v,--version Prints version information OPTIONS: - -c,--config Sets a custom config file + -c,--config Sets a custom config file POSITIONAL ARGUMENTS: - output Sets an optional output file + output Sets an optional output file SUBCOMMANDS: - help Prints this message - test Controls testing features + help Prints this message + test Controls testing features ``` ## Installation diff --git a/src/lib.rs b/src/lib.rs index da49d6de..f23c8237 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,22 +26,22 @@ //! .author("Kevin K. ") //! .about("Does awesome things") //! .arg(Arg::new("config") -//! .short("c") -//! .long("config") -//! .help("Sets a custom config file") -//! .takes_value(true)) +//! .short("c") +//! .long("config") +//! .help("Sets a custom config file") +//! .takes_value(true)) //! .arg(Arg::new("output") -//! .help("Sets an optional output file") -//! .index(1)) +//! .help("Sets an optional output file") +//! .index(1)) //! .arg(Arg::new("debug") -//! .short("d") -//! .multiple(true) -//! .help("Turn debugging information on")) +//! .short("d") +//! .multiple(true) +//! .help("Turn debugging information on")) //! .subcommand(SubCommand::new("test") -//! .about("Has test sub functionality") -//! .arg(Arg::new("verbose") -//! .short("v") -//! .help("Display verbose information"))) +//! .about("Has test sub functionality") +//! .arg(Arg::new("verbose") +//! .short("v") +//! .help("Display verbose information"))) //! .get_matches(); //! //! if let Some(o) = matches.value_of("output") { @@ -58,7 +58,7 @@ //! 2 => println!("Debug mode is on"), //! 3 | _ => println!("Don't be crazy"), //! } -//! +//! //! if let Some(ref matches) = matches.subcommand_matches("test") { //! if matches.is_present("verbose") { //! println!("Printing verbose test info...");