Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
|||
extern crate rustc_serialize;
|
||||
extern crate docopt;
|
||||
|
||||
use docopt::Docopt;
|
||||
|
||||
use std::io::{BufReader,BufRead};
|
||||
use std::fs::File;
|
||||
|
||||
const USAGE: &'static str = "
|
||||
Usage: rosetta <start> <count> <file>
|
||||
";
|
||||
|
||||
#[derive(Debug, RustcDecodable)]
|
||||
struct Args {
|
||||
arg_start: usize,
|
||||
arg_count: usize,
|
||||
arg_file: String,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args: Args = Docopt::new(USAGE)
|
||||
.and_then(|d| d.decode())
|
||||
.unwrap_or_else(|e| e.exit());
|
||||
|
||||
let file = BufReader::new(File::open(args.arg_file).unwrap());
|
||||
|
||||
for (i, line) in file.lines().enumerate() {
|
||||
let cur = i + 1;
|
||||
|
||||
if cur < args.arg_start || cur >= (args.arg_start + args.arg_count) {
|
||||
println!("{}", line.unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue