make fix cli accept a -
argument to indicate reading from stdin
I'm pretty sure we had this in the past... no? I have my helix set up to respect this argument, so it's weird it stopped working at some point.
This commit is contained in:
parent
c2a4b0169b
commit
bbf5c3b529
|
@ -134,7 +134,11 @@ pub fn fix_file(
|
||||||
|
|
||||||
pub fn fix_file_cli(fix_args: FixArgs) -> anyhow::Result<()> {
|
pub fn fix_file_cli(fix_args: FixArgs) -> anyhow::Result<()> {
|
||||||
let utf8_filename = fix_args.file.to_string_lossy().into_owned();
|
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 treehouse = Treehouse::new();
|
||||||
let mut diagnostics = vec![];
|
let mut diagnostics = vec![];
|
||||||
|
|
Loading…
Reference in a new issue