@@ -4,6 +4,7 @@ export output_format::{};
4
4
export output_style :: { } ;
5
5
export config;
6
6
export parse_config;
7
+ export usage;
7
8
8
9
#[ doc = "The type of document to output" ]
9
10
enum output_format {
@@ -34,20 +35,34 @@ fn opt_output_dir() -> str { "output-dir" }
34
35
fn opt_output_format ( ) -> str { "output-format" }
35
36
fn opt_output_style ( ) -> str { "output-style" }
36
37
fn opt_pandoc_cmd ( ) -> str { "pandoc-cmd" }
38
+ fn opt_help ( ) -> str { "h" }
37
39
38
40
fn opts ( ) -> [ ( getopts:: opt , str ) ] {
39
41
[
40
42
( getopts:: optopt ( opt_output_dir ( ) ) ,
41
- "put documents here" ) ,
43
+ "--output-dir <val> put documents here" ) ,
42
44
( getopts:: optopt ( opt_output_format ( ) ) ,
43
- "either 'markdown' or 'html'" ) ,
45
+ "--output-format <val> either 'markdown' or 'html'" ) ,
44
46
( getopts:: optopt ( opt_output_style ( ) ) ,
45
- "either 'doc-per-crate' or 'doc-per-mod'" ) ,
47
+ "--output-style <val> either 'doc-per-crate' or 'doc-per-mod'" ) ,
46
48
( getopts:: optopt ( opt_pandoc_cmd ( ) ) ,
47
- "the command for running pandoc" )
49
+ "--pandoc-cmd <val> the command for running pandoc" ) ,
50
+ ( getopts:: optflag ( opt_help ( ) ) ,
51
+ "-h print help" )
48
52
]
49
53
}
50
54
55
+ fn usage ( ) {
56
+ import std:: io:: println;
57
+
58
+ println ( "Usage: rustdoc [options] <cratefile>\n " ) ;
59
+ println ( "Options:\n " ) ;
60
+ for opt in opts ( ) {
61
+ println ( #fmt ( " %s" , tuple:: second ( opt) ) ) ;
62
+ }
63
+ println ( "" ) ;
64
+ }
65
+
51
66
fn default_config ( input_crate : str ) -> config {
52
67
{
53
68
input_crate: input_crate,
0 commit comments