File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ use clap:: Parser ;
2+ use anyhow:: { Result , bail, anyhow} ;
3+
4+ #[ derive( Parser , Debug ) ]
5+ pub struct Launch { }
6+
7+ pub fn handle ( _args : Launch ) -> Result < ( ) > {
8+ // Fetch and deserialize .android
9+ let dot_android = android_cli:: get_dot_android ( )
10+ . ok_or_else ( || anyhow ! ( ".android not found, can't launch activity" ) ) ?;
11+
12+ // Try to launch MainActivity using ADB
13+ let launch_status =
14+ android_cli:: launch_activity ( dot_android. package_id , dot_android. main_activity_name ) ?;
15+
16+ if !launch_status. success ( ) {
17+ bail ! ( "failed to launch activity" ) ;
18+ }
19+
20+ Ok ( ( ) )
21+ }
Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ pub mod build;
22pub mod create;
33pub mod install;
44pub mod run;
5+ pub mod launch;
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ enum SubCommand {
1919 Build ( commands:: build:: Build ) ,
2020 Install ( commands:: install:: Install ) ,
2121 Run ( commands:: run:: Run ) ,
22+ Launch ( commands:: launch:: Launch )
2223}
2324
2425fn main ( ) {
@@ -32,6 +33,7 @@ fn main() {
3233 SubCommand :: Build ( args) => commands:: build:: handle ( args) ,
3334 SubCommand :: Install ( args) => commands:: install:: handle ( args) ,
3435 SubCommand :: Run ( args) => commands:: run:: handle ( args) ,
36+ SubCommand :: Launch ( args) => commands:: launch:: handle ( args)
3537 } ;
3638
3739 if result. is_err ( ) {
You can’t perform that action at this time.
0 commit comments