From 153e37eafb2b33c9863781b4b5d65210534949e1 Mon Sep 17 00:00:00 2001 From: JJ Date: Thu, 23 Feb 2023 20:56:33 -0800 Subject: refactor slightly for state --- src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 62da4a5..a64aec8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,15 +2,16 @@ use std::env; use dictionarium; fn main() { + let mut state = dictionarium::State::new(); let args: Vec = env::args().skip(1).collect(); if args.len() == 0 { - dictionarium::param(String::from("--help")); + dictionarium::param(String::from("--help"), &mut state); } else { let mut words = Vec::::new(); for word in args { if word.len() > 2 && word.get(0..2).unwrap_or_default() == "--" { - dictionarium::param(word); + dictionarium::param(word, &mut state); } else { words.push(word); } @@ -18,7 +19,7 @@ fn main() { // we accept multiple words gladly for word in words { - dictionarium::handle(word); + dictionarium::handle(word, &state); } } } -- cgit v1.2.3-70-g09d2