Skip to content

Commit fc1172b

Browse files
pwoolcocPaul Woolcock
authored and
Paul Woolcock
committed
Closes rust-lang#653
Hook up the --quiet flag to the bin/run.rs subcommand
1 parent 55d9f91 commit fc1172b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/bin/run.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct Options {
1616
flag_target: Option<String>,
1717
flag_manifest_path: Option<String>,
1818
flag_verbose: bool,
19+
flag_quiet: bool,
1920
flag_release: bool,
2021
arg_args: Vec<String>,
2122
}
@@ -37,6 +38,7 @@ Options:
3738
--target TRIPLE Build for the target triple
3839
--manifest-path PATH Path to the manifest to execute
3940
-v, --verbose Use verbose output
41+
-q, --quiet No output printed to stdout
4042
4143
If neither `--name` or `--example` are given, then if the project only has one
4244
bin target it will be run. Otherwise `--name` specifies the bin target to run,
@@ -46,8 +48,23 @@ and `--example` specifies the example target to run. At most one of `--name` or
4648
All of the trailing arguments are passed as to the binary to run.
4749
";
4850

51+
4952
pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
50-
shell.set_verbose(options.flag_verbose);
53+
shell.set_verbosity(match (options.flag_verbose, options.flag_quiet) {
54+
(true, true) => {
55+
fail!("You cannot set both --verbose and --quiet");
56+
},
57+
(true, _) => {
58+
shell::Verbose
59+
},
60+
(_, true) => {
61+
shell::Quiet
62+
}
63+
_ => {
64+
shell::Normal
65+
}
66+
});
67+
5168
let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
5269

5370
let env = if options.flag_example.is_some() {

0 commit comments

Comments
 (0)