poe_data_tools-cli 2.0.0

A CLI for working with Path of Exile game data
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::io::{self, BufWriter, Write};

use anyhow::{Context, Result};
use poe_data_tools::fs::{FS, FileSystem};

/// Write the contents of the file to stdout
pub fn cat_file(fs: &mut FS, path: &str) -> Result<()> {
    let contents = fs.read(path).context("Failed to read file")?;

    let mut stdout = BufWriter::new(io::stdout().lock());
    stdout
        .write_all(&contents)
        .context("Failed to write to stdout")?;

    stdout.flush().context("Failed to flush stdout")
}