adb_utils/commands/shell/
mv.rs

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