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
+ //
1
11
extern crate mdbook;
2
12
#[ macro_use]
3
13
extern crate clap;
@@ -11,19 +21,21 @@ use clap::{App, ArgMatches, SubCommand, AppSettings};
11
21
12
22
use mdbook:: MDBook ;
13
23
14
- const NAME : & ' static str = "rustbook" ;
15
-
16
24
fn 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" )
19
31
. about ( "Build a book with mdBook" )
20
32
. author ( "Steve Klabnik <[email protected] >" )
21
33
. version ( & * format ! ( "v{}" , crate_version!( ) ) )
22
34
. setting ( AppSettings :: SubcommandRequired )
23
35
. subcommand ( SubCommand :: with_name ( "build" )
24
36
. 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 ) )
27
39
. get_matches ( ) ;
28
40
29
41
// Check which subcomamnd the user ran...
@@ -76,4 +88,3 @@ fn get_book_dir(args: &ArgMatches) -> PathBuf {
76
88
env:: current_dir ( ) . unwrap ( )
77
89
}
78
90
}
79
-
0 commit comments