Skip to content

Commit 367083e

Browse files
committed
---
yaml --- r: 14544 b: refs/heads/try c: 6c9527a h: refs/heads/master v: v3
1 parent 1d9fe27 commit 367083e

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 362f23641a737bb16b85b2da091c222bc7358dc4
5+
refs/heads/try: 6c9527ab79ab66f3f8b8426e006cf58a447c0017
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustdoc/config.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export output_format::{};
44
export output_style::{};
55
export config;
66
export parse_config;
7+
export usage;
78

89
#[doc = "The type of document to output"]
910
enum output_format {
@@ -34,20 +35,34 @@ fn opt_output_dir() -> str { "output-dir" }
3435
fn opt_output_format() -> str { "output-format" }
3536
fn opt_output_style() -> str { "output-style" }
3637
fn opt_pandoc_cmd() -> str { "pandoc-cmd" }
38+
fn opt_help() -> str { "h" }
3739

3840
fn opts() -> [(getopts::opt, str)] {
3941
[
4042
(getopts::optopt(opt_output_dir()),
41-
"put documents here"),
43+
"--output-dir <val> put documents here"),
4244
(getopts::optopt(opt_output_format()),
43-
"either 'markdown' or 'html'"),
45+
"--output-format <val> either 'markdown' or 'html'"),
4446
(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'"),
4648
(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")
4852
]
4953
}
5054

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+
5166
fn default_config(input_crate: str) -> config {
5267
{
5368
input_crate: input_crate,

branches/try/src/rustdoc/rustdoc.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ fn test_run_passes() {
9595

9696
fn main(argv: [str]) {
9797

98+
if vec::contains(argv, "-h") {
99+
config::usage();
100+
ret;
101+
}
102+
98103
if vec::len(argv) != 2u {
99104
std::io::println(#fmt("usage: %s <input>", argv[0]));
100105
ret;

0 commit comments

Comments
 (0)