Skip to content

Commit

Permalink
chore: run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
SyedAhkam committed Aug 22, 2023
1 parent 1e8cf99 commit 8115f6d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
9 changes: 7 additions & 2 deletions src/commands/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use clap::Parser;

use std::{collections::BTreeMap, path::PathBuf};

use crate::utils::{prompt_for_input, parse_package_id};
use crate::utils::{parse_package_id, prompt_for_input};

const DEFAULT_COMPILE_SDK_VERSION: &str = "33";
const DEFAULT_TARGET_SDK_VERSION: &str = "33";
Expand Down Expand Up @@ -78,7 +78,12 @@ fn post_create(args: Create) -> Result<()> {
let dest = args.dest.clone().unwrap();

android_cli::create_local_properties_file(&dest, &args.sdk_path.unwrap())?;
android_cli::create_dot_android(&dest, args.project_name.unwrap(), args.package_id.unwrap(), None)?;
android_cli::create_dot_android(
&dest,
args.project_name.unwrap(),
args.package_id.unwrap(),
None,
)?;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/launch.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::{anyhow, bail, Result};
use clap::Parser;
use anyhow::{Result, bail, anyhow};

#[derive(Parser, Debug)]
pub struct Launch {}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod build;
pub mod create;
pub mod devices;
pub mod install;
pub mod run;
pub mod launch;
pub mod devices;
pub mod link;
pub mod run;
9 changes: 7 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,18 @@ pub fn invoke_adb_command(args: &[&str]) -> Result<ExitStatus> {
Ok(run.status()?)
}

pub fn create_dot_android(dest: &Path, project_name: String, package_id: String, main_activity_name: Option<String>) -> Result<()> {
pub fn create_dot_android(
dest: &Path,
project_name: String,
package_id: String,
main_activity_name: Option<String>,
) -> Result<()> {
// Construct the structure
let dot_android = DotAndroid {
package_id,
project_name,
gen_at_version: VERSION.to_owned(),
main_activity_name: main_activity_name.unwrap_or(DEFAULT_MAIN_ACTIVITY.to_owned())
main_activity_name: main_activity_name.unwrap_or(DEFAULT_MAIN_ACTIVITY.to_owned()),
};

// Serialize into Ron
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum SubCommand {
Run(commands::run::Run),
Launch(commands::launch::Launch),
Devices(commands::devices::Devices),
Link(commands::link::Link)
Link(commands::link::Link),
}

fn main() {
Expand All @@ -37,7 +37,7 @@ fn main() {
SubCommand::Run(args) => commands::run::handle(args),
SubCommand::Launch(args) => commands::launch::handle(args),
SubCommand::Devices(args) => commands::devices::handle(args),
SubCommand::Link(args) => commands::link::handle(args)
SubCommand::Link(args) => commands::link::handle(args),
};

if result.is_err() {
Expand Down
1 change: 0 additions & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub fn parse_package_id(package_id: String) -> Result<(String, String, String)>
anyhow::Ok((domain.to_owned(), org.to_owned(), name.to_owned()))
}


pub fn safe_name(name: String) -> String {
name.to_lowercase().replace(" ", "_")
}
Expand Down

0 comments on commit 8115f6d

Please sign in to comment.