1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use std::process::Command;

use super::ADBCommand;

#[derive(Default)]
pub struct ADBList {
    path: Option<String>,
}

impl ADBCommand for ADBList {
    fn path(&mut self, path: String) {
        self.path = Some(path);
    }

    fn build(&self) -> Result<Command, String> {
        match &self.path {
            Some(path) => {
                let mut shell = Command::new("adb");
                shell.arg("shell");
                // if params.len() > 0 {
                //     shell.arg(format!("ls {}{}", path, params[0]));
                // } else {
                shell.arg(format!("ls {}", path));
                // }
                Ok(shell)
            }
            None => Err("No path specified".to_string()),
        }
    }
}