diff --git a/src/commands/create.rs b/src/commands/create.rs index 7bbb465..17681a8 100644 --- a/src/commands/create.rs +++ b/src/commands/create.rs @@ -1,4 +1,4 @@ -use anyhow::{Context, Result, anyhow}; +use anyhow::{anyhow, Context, Result}; use clap::Parser; use std::{collections::BTreeMap, path::PathBuf}; @@ -49,9 +49,15 @@ fn get_vars(args: &Create) -> Result> { // FIXME: this is a hack, we should use a proper parser let get_package_id = |package_id: String| { let mut parts = package_id.split('.'); - let domain = parts.next().ok_or_else(|| anyhow!("domain part missing in package"))?; - let org = parts.next().ok_or_else(|| anyhow!("org part missing in package"))?; - let name = parts.next().ok_or_else(|| anyhow!("name part missing in package"))?; + let domain = parts + .next() + .ok_or_else(|| anyhow!("domain part missing in package"))?; + let org = parts + .next() + .ok_or_else(|| anyhow!("org part missing in package"))?; + let name = parts + .next() + .ok_or_else(|| anyhow!("name part missing in package"))?; anyhow::Ok((domain.to_owned(), org.to_owned(), name.to_owned())) }; diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 11a360e..291abff 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,4 +1,4 @@ -pub mod create; pub mod build; +pub mod create; pub mod install; pub mod run; diff --git a/src/main.rs b/src/main.rs index c714064..aa3432c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,7 +18,7 @@ enum SubCommand { Create(commands::create::Create), Build(commands::build::Build), Install(commands::install::Install), - Run(commands::run::Run) + Run(commands::run::Run), } fn main() { @@ -31,7 +31,7 @@ fn main() { SubCommand::Create(args) => commands::create::handle(args), SubCommand::Build(args) => commands::build::handle(args), SubCommand::Install(args) => commands::install::handle(args), - SubCommand::Run(args) => commands::run::handle(args) + SubCommand::Run(args) => commands::run::handle(args), }; if result.is_err() { diff --git a/src/utils.rs b/src/utils.rs index a7224df..05c30fd 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,13 +1,15 @@ #![allow(dead_code)] -use anyhow::{Result, Context}; +use anyhow::{Context, Result}; use which::which; pub fn prompt_for_input(prompt: &str) -> Result { - Ok(dialoguer::Input::::with_theme(&dialoguer::theme::ColorfulTheme::default()) - .with_prompt(prompt) - .interact_text() - .context("failed to prompt user")?) + Ok( + dialoguer::Input::::with_theme(&dialoguer::theme::ColorfulTheme::default()) + .with_prompt(prompt) + .interact_text() + .context("failed to prompt user")?, + ) } pub fn find_gradle() -> Option {