Skip to content

Commit 0a9f544

Browse files
committed
---
yaml --- r: 2382 b: refs/heads/master c: f5f2f76 h: refs/heads/master v: v3
1 parent 7596eef commit 0a9f544

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: a74feaf1594673bcec77ed45bd4b6766289a25b3
2+
refs/heads/master: f5f2f763395c3336b739866927a56edfbd1f204b

trunk/src/comp/driver/rustc.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,21 @@ fn pretty_print_input(session.session sess,
126126
pretty.pprust.print_file(crate.node.module, input, std.io.stdout());
127127
}
128128

129+
fn version(str argv0) {
130+
auto git_rev = ""; // when snapshotted to extenv: #env("GIT_REV");
131+
if (_str.byte_len(git_rev) != 0u) {
132+
git_rev = #fmt(" (git: %s)", git_rev);
133+
}
134+
io.stdout().write_str(#fmt("%s prerelease%s\n", argv0, git_rev));
135+
}
136+
129137
fn usage(str argv0) {
130138
io.stdout().write_str(#fmt("usage: %s [options] <input>\n", argv0) + "
131139
options:
132140
141+
-h --help display this message
142+
-v --version print version info and exit
143+
133144
-o <filename> write output to <filename>
134145
--glue generate glue.bc file
135146
--shared compile a shared-library crate
@@ -146,8 +157,7 @@ options:
146157
--save-temps write intermediate files in addition to normal output
147158
--time-passes time the individual phases of the compiler
148159
--sysroot <path> override the system root (default: rustc's directory)
149-
--no-typestate don't run the typestate pass (unsafe!)
150-
-h display this message\n\n");
160+
--no-typestate don't run the typestate pass (unsafe!)\n\n");
151161
}
152162

153163
fn get_os() -> session.os {
@@ -173,7 +183,9 @@ fn main(vec[str] args) {
173183
uint_type = common.ty_u32,
174184
float_type = common.ty_f64);
175185

176-
auto opts = vec(optflag("h"), optflag("glue"),
186+
auto opts = vec(optflag("h"), optflag("help"),
187+
optflag("v"), optflag("version"),
188+
optflag("glue"),
177189
optflag("pretty"), optflag("ls"), optflag("parse-only"),
178190
optflag("O"), optflag("shared"), optmulti("L"),
179191
optflag("S"), optflag("c"), optopt("o"), optopt("g"),
@@ -189,11 +201,18 @@ fn main(vec[str] args) {
189201
}
190202
case (GetOpts.success(?m)) { match = m; }
191203
}
192-
if (opt_present(match, "h")) {
204+
if (opt_present(match, "h") ||
205+
opt_present(match, "help")) {
193206
usage(binary);
194207
ret;
195208
}
196209

210+
if (opt_present(match, "v") ||
211+
opt_present(match, "version")) {
212+
version(binary);
213+
ret;
214+
}
215+
197216
auto pretty = opt_present(match, "pretty");
198217
auto ls = opt_present(match, "ls");
199218
auto glue = opt_present(match, "glue");

0 commit comments

Comments
 (0)