Narrow the supported options on the format CLI (#6944)

## Summary

Ensures that we only show supported options:

<img width="1228" alt="Screen Shot 2023-08-28 at 11 03 16 AM"
src="50fb7595-dc30-43d2-a7e4-c0103acc15b9">

For now, I'm not super focused on DRYing up the CLI.
This commit is contained in:
Charlie Marsh 2023-08-28 11:28:22 -04:00 committed by GitHub
parent aea7500c1e
commit ec575188c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 135 additions and 83 deletions

View file

@ -16,12 +16,12 @@ use ruff_python_ast::{PySourceType, SourceType};
use ruff_python_formatter::{format_module, FormatModuleError, PyFormatOptions};
use ruff_workspace::resolver::python_files_in_path;
use crate::args::{Arguments, Overrides};
use crate::args::{FormatArguments, Overrides};
use crate::resolve::resolve;
use crate::ExitStatus;
/// Format a set of files, and return the exit status.
pub(crate) fn format(cli: &Arguments, overrides: &Overrides) -> Result<ExitStatus> {
pub(crate) fn format(cli: &FormatArguments, overrides: &Overrides) -> Result<ExitStatus> {
let pyproject_config = resolve(
cli.isolated,
cli.config.as_deref(),
@ -59,7 +59,7 @@ pub(crate) fn format(cli: &Arguments, overrides: &Overrides) -> Result<ExitStatu
err
})
})
.collect::<Result<Vec<_>, _>>();
.collect::<Result<(), _>>();
if result.is_ok() {
Ok(ExitStatus::Success)