bitsy-parser 0.70.2

A parser and utilities for working with Bitsy game data
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extern crate bitsy_parser;
use bitsy_parser::game::Game;
use std::{env, fs};

const SYNTAX_ERROR: &str = "No game data specified. Usage: `bitsy-dedupe input.bitsy output.bitsy`";

fn main() {
    let game   = env::args().nth(1).expect(SYNTAX_ERROR);
    let output = env::args().nth(2).expect(SYNTAX_ERROR);

    let mut game = Game::from(fs::read_to_string(game).unwrap()).unwrap();

    game.dedupe_tiles();

    fs::write(output, game.to_string()).expect("Failed to write output file");
}