-// ## External Dependencies
-
-
-// I disabled the following module (using a rather bad hack), because it only compiles if `docopt` is linked. However, before enabling it,
-// you still have get the external library into the global namespace. This is done with `extern crate docopt`, and that statement *has* to be
-// in `main.rs`. So please go there, and enable this commented-out line. Then remove the attribute of the `rgrep` module.
-#[cfg(feature = "disabled")]
-pub mod rgrep {
- // Now that `docopt` is linked and declared in `main.rs`, we can import it with `use`. We also import some other pieces that we will need.
- use docopt::Docopt;
- use part12::{run, Options, OutputMode};
- use std::process;
-
- // The `USAGE` string documents how the program is to be called. It's written in a format that `docopt` can parse.
- static USAGE: &'static str = "
-Usage: rgrep [-c] [-s] <pattern> <file>...
-
-Options:
- -c, --count Count number of matching lines (rather than printing them).
- -s, --sort Sort the lines before printing.
-";
-
- // This function extracts the rgrep options from the command-line arguments.
- fn get_options() -> Options {
- // Parse `argv` and exit the program with an error message if it fails. This is taken from the [`docopt` documentation](http://burntsushi.net/rustdoc/docopt/).
- let args = Docopt::new(USAGE).and_then(|d| d.parse()).unwrap_or_else(|e| e.exit());
- // Now we can get all the values out.
- let count = args.get_bool("-c");
- let sort = args.get_bool("-s");
- let pattern = args.get_str("<pattern>");
- let files = args.get_vec("<file>");
- if count && sort {
- println!("Setting both '-c' and '-s' at the same time does not make any sense.");
- process::exit(1);
- }
+// Now we have all the pieces together for testing our rgrep with some hard-coded options.
+pub fn main() {
+ let options = Options {
+ files: vec!["src/part10.rs".to_string(),
+ "src/part11.rs".to_string(),
+ "src/part12.rs".to_string()],
+ pattern: "let".to_string(),
+ output_mode: Print
+ };
+ run(options);
+}