Added some comments.
This commit is contained in:
@@ -28,17 +28,20 @@ fn main() {
|
|||||||
opts.optopt("S", "seed", "Rainbow seed, 0 = random", "<i>");
|
opts.optopt("S", "seed", "Rainbow seed, 0 = random", "<i>");
|
||||||
opts.optflag("h", "help", "Show this message");
|
opts.optflag("h", "help", "Show this message");
|
||||||
|
|
||||||
|
// @todo do not panic!
|
||||||
let matches = match opts.parse(&args[1..]) {
|
let matches = match opts.parse(&args[1..]) {
|
||||||
Ok(m) => { m }
|
Ok(m) => { m }
|
||||||
Err(f) => { panic!(f.to_string()) }
|
Err(f) => { panic!(f.to_string()) }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// print usage?
|
||||||
if matches.opt_present("h") {
|
if matches.opt_present("h") {
|
||||||
print_usage(&program, opts);
|
print_usage(&program, opts);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get spread.
|
||||||
// @todo this is nasty... fix this.
|
// @todo this is nasty... fix this.
|
||||||
let spread : f32 = match matches.opt_default("spread", "3.0") {
|
let spread : f32 = match matches.opt_default("spread", "3.0") {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
@@ -51,6 +54,7 @@ fn main() {
|
|||||||
None => 3.0
|
None => 3.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// get freq.
|
||||||
// @todo this is nasty... fix this.
|
// @todo this is nasty... fix this.
|
||||||
let freq : f32 = match matches.opt_default("freq", "0.1") {
|
let freq : f32 = match matches.opt_default("freq", "0.1") {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
@@ -63,6 +67,7 @@ fn main() {
|
|||||||
None => 0.1
|
None => 0.1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// get seed.
|
||||||
// @todo this is nasty... fix this.
|
// @todo this is nasty... fix this.
|
||||||
let mut seed : i32 = match matches.opt_default("seed", "0") {
|
let mut seed : i32 = match matches.opt_default("seed", "0") {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
@@ -77,6 +82,7 @@ fn main() {
|
|||||||
|
|
||||||
let stdin = io::stdin();
|
let stdin = io::stdin();
|
||||||
|
|
||||||
|
// @todo I want to use chars() instead, but it's unstable right now :(
|
||||||
for line in stdin.lock().lines() {
|
for line in stdin.lock().lines() {
|
||||||
seed += 1;
|
seed += 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user