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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use std::path::PathBuf;
use clap::Parser;
use super::RebootTypeCommand;
#[derive(Parser, Debug)]
pub enum DeviceCommands {
/// Spawn an interactive shell or run a list of commands on the device
Shell {
#[arg(trailing_var_arg = true)]
commands: Vec<String>,
},
/// Pull a file from device
Pull { source: String, destination: String },
/// Push a file on device
Push { filename: String, path: String },
/// Stat a file on device
Stat { path: String },
/// Stat a file on device with extended information
StatExtended { path: String },
/// Run an activity on device specified by the intent
Run {
/// The package whose activity is to be invoked
#[clap(short = 'p', long = "package")]
package: String,
/// The activity to be invoked itself, Usually it is `MainActivity`
#[clap(short = 'a', long = "activity")]
activity: String,
},
/// Reboot the device
Reboot {
#[clap(subcommand)]
reboot_type: RebootTypeCommand,
},
/// Install an APK on device
Install {
/// User id to install the package for
#[clap(short = 'u', long = "user")]
user: Option<String>,
/// Path to APK file. Extension must be ".apk"
path: PathBuf,
},
/// Uninstall a package from the device
Uninstall {
/// User id of the package to uninstall
#[clap(short = 'u', long = "user")]
user: Option<String>,
/// Name of the package to uninstall
package: String,
},
/// Dump framebuffer of device
Framebuffer {
/// Framebuffer image destination path
path: String,
},
/// List files on device
List {
/// Path to list files from
path: String,
},
/// Restart adb daemon with root permissions
Root,
}