Skip to content

Commit

Permalink
Merge pull request #10 from JeromeSchmied/dev
Browse files Browse the repository at this point in the history
empty universe fix
  • Loading branch information
JeromeSchmied authored Sep 29, 2024
2 parents 823dc7e + d9d035d commit 566029d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cgol-tui"
version = "0.5.2"
version = "0.5.3"
authors = ["Jeromos Kovacs <[email protected]>"]
edition = "2021"
description = "Conway's Game of Life implementation with a TUI"
Expand Down
13 changes: 8 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@ where <pattern> is either a .cells file, or - for stdin"
if args.len() == 1 && args[0] == "-" {
std::io::stdin().read_to_string(&mut univ)?;
}
Universe::from_str(&univ)?
if univ.is_empty() {
vec![]
} else {
vec![Universe::from_str(&univ)?]
}
};

let mut universes = args
let universes = args
.iter()
.flat_map(std::fs::read_to_string)
.map(|s| Universe::from_str(&s))
.collect::<Result<Vec<_>, _>>()?;
universes.push(piped_universe);
let mut app = App::default().with_universes(universes);

let mut app = App::default().with_universes([universes, piped_universe].concat());

let mut terminal = ratatui::try_init()?;

Expand Down

0 comments on commit 566029d

Please sign in to comment.