Use new formatter infrastructure in CLI and test (#4767)

* Use dummy verbatim formatter for all nodes

* Use new formatter infrastructure in CLI and test

* Expose the new formatter in the CLI

* Merge import blocks
This commit is contained in:
konstin 2023-06-01 11:55:04 +02:00 committed by GitHub
parent 9bf168c0a4
commit d4027d8b65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 41 deletions

View file

@ -6,12 +6,10 @@ use clap::Parser as ClapParser;
use ruff_python_formatter::cli::Cli;
use ruff_python_formatter::format_module;
#[allow(clippy::print_stdout)]
fn main() -> Result<()> {
let cli = Cli::parse();
let contents = fs::read_to_string(cli.file)?;
#[allow(clippy::print_stdout)]
{
println!("{}", format_module(&contents)?.as_code());
}
println!("{}", format_module(&contents)?.as_code());
Ok(())
}