/// build a AppStateCmdResult with a launchable which will be used to
///  1/ quit broot
///  2/ open the relevant file the best possible way
build a AppStateCmdResult with a launchable which will be used to
1/ quit broot
2/ open the relevant file the best possible way
build a AppStateCmdResult with a launchable which will be used to 1 / quit broot 2 / open the relevant file the best possible way
fn make_opener(path: PathBuf, is_exe: bool, con: &AppContext) -> io::Result<AppStateCmdResult> {
    Ok(
        if is_exe {
            let path = path.to_string_lossy().to_string();
            if let Some(export_path) = &con.launch_args.cmd_export_path {
                // broot was launched as br, we can launch the executable from the shell
                let f = OpenOptions::new().append(true).open(export_path)?;
                writeln!(&f, "{}", path)?;
                AppStateCmdResult::Quit
            } else {
                AppStateCmdResult::from(Launchable::program(vec![path])?)
            }
        } else {
            AppStateCmdResult::from(Launchable::opener(path))
        }
    )
}
fn make_opener ( path : PathBuf , is_exe : bool , con : & AppContext ) -> io :: Result < AppStateCmdResult > { Ok ( if is_exe { let path = path . to_string_lossy ( ) . to_string ( ) ; if let Some ( export_path ) = & con . launch_args . cmd_export_path { // broot was launched as br, we can launch the executable from the shell let f = OpenOptions :: new ( ) . append ( true ) . open ( export_path ) ? ; writeln ! ( f " " path ) ? ; AppStateCmdResult :: Quit } else { AppStateCmdResult :: from ( Launchable :: program ( vec ! [ path ] ) ? ) } } else { AppStateCmdResult :: from ( Launchable :: opener ( path ) ) } ) }
build a AppStateCmdResult with a launchable which will be used to
1/ quit broot
2/ open the relevant file the best possible way
build a AppStateCmdResult with a launchable which will be used to 1 / quit broot 2 / open the relevant file the best possible way
path
PathBuf
is_exe
bool
con
&AppContext