adb_utils/commands/shell/
list.rs

1use std::process::Command;
2
3use crate::{ADBPathCommand, ADBResult};
4
5pub struct ADBList {
6    path: Option<String>,
7    shell: Command,
8}
9
10impl Default for ADBList {
11    fn default() -> Self {
12        let mut cmd = Command::new("adb");
13        cmd.arg("shell").arg("ls");
14
15        ADBList {
16            path: None,
17            shell: cmd,
18        }
19    }
20}
21
22impl ADBPathCommand for ADBList {
23    fn path(&mut self, path: Option<String>) {
24        self.path = path
25    }
26
27    fn build(&mut self) -> Result<&mut Command, String> {
28        match &self.path {
29            Some(path) => {
30                self.shell.arg(path);
31                Ok(&mut self.shell)
32            }
33            None => Ok(&mut self.shell),
34        }
35    }
36
37    fn process_output(&self, output: ADBResult) -> ADBResult {
38        output
39    }
40}