Use singular for directory names

This commit is contained in:
Nathan Stocks
2021-06-12 23:36:49 -06:00
parent b492b359b3
commit 9848a889ea
20 changed files with 2 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
use anyhow::{Context, Result};
use log::info;
use puzzles::Puzzle;
use std::fs::File;
fn get_puzzle(filename: &str) -> Result<Puzzle> {
let fh = File::open(filename)
.with_context(|| format!("couldn't open the puzzle file {}", filename))?;
let puzzle = Puzzle::from_file(fh).context("couldn't convert data into a puzzle")?;
Ok(puzzle)
}
fn main() -> Result<()> {
env_logger::init();
let puzzle = match get_puzzle("puzzle.dat").context("Couldn't get the first puzzle") {
Ok(p) => p,
Err(_) => Puzzle::new(),
};
info!("Playing puzzle: {}", puzzle.name);
Ok(())
}