schema_registry_cli/
lib.rs

1#![warn(missing_docs)]
2#![forbid(unsafe_code)]
3#![warn(clippy::perf)]
4#![warn(clippy::pedantic)]
5#![allow(clippy::module_name_repetitions)]
6#![doc = include_str!("../README.md")]
7
8/// The result type
9pub type Result<T> = std::result::Result<T, CliError>;
10
11mod error;
12mod init_tracing;
13mod settings;
14
15/// Commands that can be run
16pub mod command;
17
18pub use self::error::*;
19pub use self::init_tracing::*;
20pub use self::settings::*;
21
22/// Process the command
23///
24/// # Errors
25///
26/// Fail if the command fail
27pub async fn process(settings: Settings) -> Result<()> {
28    let verbose = settings.verbosity >= Verbosity::INFO;
29    match settings.command {
30        Command::Subject(sub_cmd) => match sub_cmd {
31            SubjectSubCommand::List(l) => command::display_list_subjects(l).await?,
32            SubjectSubCommand::Register(r) => command::display_register_schema(r).await?,
33            SubjectSubCommand::Delete(d) => command::display_delete_subject(d).await?,
34            SubjectSubCommand::Check(c) => command::display_check_compatibility(c, verbose).await?,
35        },
36        Command::Schema(sub_cmd) => match sub_cmd {
37            SchemaSubCommand::Get(g) => command::display_get_schema(g).await?,
38        },
39        Command::Completion(c) => command::generate_completion(c)?,
40    }
41
42    Ok(())
43}