Refactor Options representation (#7591)

This commit is contained in:
Micha Reiser 2023-09-22 18:19:58 +02:00 committed by GitHub
parent f137819536
commit 2ecf59726f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 343 additions and 177 deletions

View file

@ -1,12 +1,13 @@
use anyhow::{anyhow, Result};
use ruff_workspace::options::Options;
use ruff_workspace::options_base::OptionsMetadata;
#[allow(clippy::print_stdout)]
pub(crate) fn config(key: Option<&str>) -> Result<()> {
match key {
None => print!("{}", Options::metadata()),
Some(key) => match Options::metadata().get(key) {
Some(key) => match Options::metadata().find(key) {
None => {
return Err(anyhow!("Unknown option: {key}"));
}