1- mod build_dirs;
2- mod command;
3- mod manifest;
4- pub mod process;
5- pub mod state;
6- mod utils;
7-
81use std:: fs;
92use std:: path:: PathBuf ;
103
114use anyhow:: Result ;
125use colored:: * ;
13- use command:: { flatpak_builder, run_command} ;
146use dialoguer:: { Select , theme:: ColorfulTheme } ;
157use nix:: unistd:: geteuid;
168
179use crate :: build_dirs:: BuildDirs ;
10+ use crate :: command:: { flatpak_builder, run_command} ;
1811use crate :: manifest:: { Manifest , Module , find_manifests_in_path} ;
19- use crate :: process:: kill_process_group;
2012use crate :: state:: State ;
2113use crate :: utils:: { get_a11y_bus_args, get_host_env} ;
2214
@@ -46,16 +38,25 @@ impl<'a> FlatpakManager<'a> {
4638 fn auto_select_manifest ( & mut self ) -> Result < bool > {
4739 let manifests = self . find_manifests ( ) ?;
4840 if let Some ( manifest_path) = manifests. first ( ) {
49- self . state . active_manifest = Some ( manifest_path. clone ( ) ) ;
50- self . state . save ( ) ?;
5141 println ! ( "{} {:?}" , "Auto-selected manifest:" . green( ) , manifest_path) ;
52- self . manifest = Some ( Manifest :: from_file ( manifest_path) ?) ;
42+ let manifest = Manifest :: from_file ( manifest_path) ?;
43+ self . set_active_manifest ( manifest_path. clone ( ) , Some ( manifest) ) ?;
5344 Ok ( true )
5445 } else {
5546 Ok ( false )
5647 }
5748 }
5849
50+ fn print_manifest_info ( & self ) {
51+ if let Some ( manifest) = & self . manifest {
52+ println ! ( "{}" , "Manifest Info:" . bold( ) . blue( ) ) ;
53+ println ! ( " App ID: {}" , manifest. id. yellow( ) ) ;
54+ println ! ( " SDK: {}" , manifest. sdk. cyan( ) ) ;
55+ println ! ( " Runtime: {}" , manifest. runtime. cyan( ) ) ;
56+ println ! ( " Runtime Version: {}" , manifest. runtime_version. cyan( ) ) ;
57+ }
58+ }
59+
5960 pub fn new ( state : & ' a mut State ) -> Result < Self > {
6061 let manifest = if let Some ( path) = & state. active_manifest {
6162 Some ( Manifest :: from_file ( path) ?)
@@ -71,6 +72,12 @@ impl<'a> FlatpakManager<'a> {
7172 if manager. manifest . is_none ( ) && !manager. auto_select_manifest ( ) ? {
7273 return Err ( anyhow:: anyhow!( "No manifest found." ) ) ;
7374 }
75+
76+ // Print manifest info when we have one
77+ if manager. manifest . is_some ( ) {
78+ manager. print_manifest_info ( ) ;
79+ }
80+
7481 manager. init ( ) ?;
7582 Ok ( manager)
7683 }
@@ -335,15 +342,18 @@ impl<'a> FlatpakManager<'a> {
335342 self . state . save ( )
336343 }
337344
345+ pub fn rebuild ( & mut self ) -> Result < ( ) > {
346+ println ! ( "{}" , "Rebuilding application..." . bold( ) ) ;
347+ self . clean ( ) ?;
348+ self . build ( )
349+ }
350+
338351 pub fn build_and_run ( & mut self ) -> Result < ( ) > {
352+ println ! ( "{}" , "Building and running application..." . bold( ) ) ;
339353 self . build ( ) ?;
340354 self . run ( )
341355 }
342356
343- pub fn stop ( & mut self ) -> Result < ( ) > {
344- kill_process_group ( self . state )
345- }
346-
347357 pub fn run ( & self ) -> Result < ( ) > {
348358 if !self . state . application_built {
349359 println ! (
@@ -572,6 +582,10 @@ impl<'a> FlatpakManager<'a> {
572582 if let Some ( manifest) = manifest {
573583 self . manifest = Some ( manifest) ;
574584 }
585+
586+ // Print manifest info
587+ self . print_manifest_info ( ) ;
588+
575589 println ! (
576590 "{} {:?}. You can now run `{}`." ,
577591 "Selected manifest:" . green( ) ,
0 commit comments