aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs
index a64aec8..e31b384 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,20 +6,21 @@ fn main() {
let args: Vec<String> = env::args().skip(1).collect();
if args.len() == 0 {
- dictionarium::param(String::from("--help"), &mut state);
- } else {
- let mut words = Vec::<String>::new();
- for word in args {
- if word.len() > 2 && word.get(0..2).unwrap_or_default() == "--" {
- dictionarium::param(word, &mut state);
- } else {
- words.push(word);
- }
- }
+ dictionarium::handle_parameter("--help", &mut state);
+ std::process::exit(0);
+ }
- // we accept multiple words gladly
- for word in words {
- dictionarium::handle(word, &state);
+ let mut words = Vec::<String>::new();
+ for word in args {
+ if word.get(0..2) == Some("--") {
+ dictionarium::handle_parameter(&word, &mut state);
+ } else {
+ words.push(word);
}
}
+
+ // we accept multiple words gladly
+ for word in words {
+ dictionarium::handle_word(word, &state);
+ }
}