Skip to content

Commit

Permalink
fix: unused import warning
Browse files Browse the repository at this point in the history
  • Loading branch information
SyedAhkam committed Oct 9, 2023
1 parent 90ed6aa commit ff5d370
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions src/commands/run.rs
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
use anyhow::{anyhow, bail, Context, Result};
use clap::{ArgAction, Parser};

#[derive(Parser, Debug)]
pub struct Run {
/// Should build in release mode
#[clap(short, long, default_value="false", action = ArgAction::SetTrue)]
release: bool,
}

pub fn handle(args: Run) -> Result<()> {
// Trigger a build
let build_status = android_cli::trigger_build(args.release)?;
if !build_status.success() {
bail!("failed to build project");
}

// Request an install to device
let install_status = android_cli::install_apk(args.release)?;
if !install_status.success() {
bail!("failed to install APK");
}

// Fetch and deserialize .android
let dot_android = android_cli::get_dot_android()
.ok_or_else(|| anyhow!(".android not found, can't launch activity"))?;

// Try to launch MainActivity using ADB
let launch_status =
android_cli::launch_activity(dot_android.package_id, dot_android.main_activity_name)?;
if !launch_status.success() {
bail!("failed to launch activity");
}

Ok(())
}
use anyhow::{anyhow, bail, Result};
use clap::{ArgAction, Parser};

#[derive(Parser, Debug)]
pub struct Run {
/// Should build in release mode
#[clap(short, long, default_value="false", action = ArgAction::SetTrue)]
release: bool,
}

pub fn handle(args: Run) -> Result<()> {
// Trigger a build
let build_status = android_cli::trigger_build(args.release)?;
if !build_status.success() {
bail!("failed to build project");
}

// Request an install to device
let install_status = android_cli::install_apk(args.release)?;
if !install_status.success() {
bail!("failed to install APK");
}

// Fetch and deserialize .android
let dot_android = android_cli::get_dot_android()
.ok_or_else(|| anyhow!(".android not found, can't launch activity"))?;

// Try to launch MainActivity using ADB
let launch_status =
android_cli::launch_activity(dot_android.package_id, dot_android.main_activity_name)?;
if !launch_status.success() {
bail!("failed to launch activity");
}

Ok(())
}

0 comments on commit ff5d370

Please sign in to comment.