1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+ //
111extern crate mdbook;
212#[ macro_use]
313extern crate clap;
@@ -11,19 +21,21 @@ use clap::{App, ArgMatches, SubCommand, AppSettings};
1121
1222use mdbook:: MDBook ;
1323
14- const NAME : & ' static str = "rustbook" ;
15-
1624fn main ( ) {
17- // Create a list of valid arguments and sub-commands
18- let matches = App :: new ( NAME )
25+ let d_message = "-d, --dest-dir=[dest-dir]
26+ 'The output directory for your book{n}(Defaults to ./book when omitted)'" ;
27+ let dir_message = "[dir]
28+ 'A directory for your book{n}(Defaults to Current Directory when omitted)'" ;
29+
30+ let matches = App :: new ( "rustbook" )
1931 . about ( "Build a book with mdBook" )
2032 . author ( "Steve Klabnik <steve@steveklabnik.com>" )
2133 . version ( & * format ! ( "v{}" , crate_version!( ) ) )
2234 . setting ( AppSettings :: SubcommandRequired )
2335 . subcommand ( SubCommand :: with_name ( "build" )
2436 . about ( "Build the book from the markdown files" )
25- . arg_from_usage ( "-d, --dest-dir=[dest-dir] 'The output directory for your book{n}(Defaults to ./book when omitted)'" )
26- . arg_from_usage ( "[dir] 'A directory for your book{n}(Defaults to Current Directory when omitted)'" ) )
37+ . arg_from_usage ( d_message )
38+ . arg_from_usage ( dir_message ) )
2739 . get_matches ( ) ;
2840
2941 // Check which subcomamnd the user ran...
@@ -76,4 +88,3 @@ fn get_book_dir(args: &ArgMatches) -> PathBuf {
7688 env:: current_dir ( ) . unwrap ( )
7789 }
7890}
79-
0 commit comments