diff --git a/crates/treehouse/src/cli/fix.rs b/crates/treehouse/src/cli/fix.rs index f0211ee..8a98967 100644 --- a/crates/treehouse/src/cli/fix.rs +++ b/crates/treehouse/src/cli/fix.rs @@ -134,7 +134,11 @@ pub fn fix_file( pub fn fix_file_cli(fix_args: FixArgs) -> anyhow::Result<()> { let utf8_filename = fix_args.file.to_string_lossy().into_owned(); - let file = std::fs::read_to_string(&fix_args.file).context("cannot read file to fix")?; + let file = if utf8_filename == "-" { + std::io::read_to_string(std::io::stdin().lock()).context("cannot read file from stdin")? + } else { + std::fs::read_to_string(&fix_args.file).context("cannot read file to fix")? + }; let mut treehouse = Treehouse::new(); let mut diagnostics = vec![];