in usort/cli.py [0:0]
def format(filenames: List[str]) -> int:
"""
Format one or more paths
This is intended to sort nodes separated by barriers, and that's it.
We don't format them (aside from moving comments). Black does the rest.
When in doubt leave lines alone.
"""
if not filenames:
raise click.ClickException("Provide some filenames")
if filenames[0].strip() == "-":
success = usort_stdin()
return 0 if success else 1
return_code = 0
for f in filenames:
path = Path(f)
for result in usort_path(path, write=True):
if result.error:
click.echo(f"Error sorting {result.path}: {result.error}")
return_code |= 1
continue
for warning in result.warnings:
click.echo(f"Warning at {result.path}:{warning.line} {warning.message}")
if result.content != result.output:
click.echo(f"Sorted {result.path}")
print_benchmark(result.timings)
return return_code