pub fn from_cli(cli: Cli) -> Result<Self> {
        let basedir = get_current_dir()?;
        let basedir_clone = basedir.clone();
        let mut paths = cli.paths.into_iter().map(|p| {
            if p.is_relative() {
                basedir_clone.join(p)
            } else {
                p
            }
        });
        let mut pwd = paths.next().unwrap_or_else(|| basedir.clone());
        let mut focused_path = None;

        if cli.force_focus || pwd.is_file() {
            focused_path = pwd.file_name().map(|p| p.into());
            pwd = pwd.parent().map(|p| p.into()).unwrap_or(basedir);
        }

        Ok(Self {
            pwd,
            focused_path,
            config_file: cli.config,
            extra_config_files: cli.extra_config,
            on_load: cli.on_load,
            read_only: cli.read_only,
            selection: paths.collect(),
        })
    }
/// Create a new runner object passing the given arguments
Create a new runner object passing the given arguments
Create a new runner object passing the given arguments
pub fn from_cli(cli: Cli) -> Result<Self> {
        let basedir = get_current_dir()?;
        let basedir_clone = basedir.clone();
        let mut paths = cli.paths.into_iter().map(|p| {
            if p.is_relative() {
                basedir_clone.join(p)
            } else {
                p
            }
        });
        let mut pwd = paths.next().unwrap_or_else(|| basedir.clone());
        let mut focused_path = None;
        if cli.force_focus || pwd.is_file() {
            focused_path = pwd.file_name().map(|p| p.into());
            pwd = pwd.parent().map(|p| p.into()).unwrap_or(basedir);
        }
        Ok(Self {
            pwd,
            focused_path,
            config_file: cli.config,
            extra_config_files: cli.extra_config,
            on_load: cli.on_load,
            read_only: cli.read_only,
            selection: paths.collect(),
        })
    }
pub fn from_cli ( cli : Cli ) -> Result < Self > { let basedir = get_current_dir ( ) ? ; let basedir_clone = basedir . clone ( ) ; let mut paths = cli . paths . into_iter ( ) . map ( | p | { if p . is_relative ( ) { basedir_clone . join ( p ) } else { p } } ) ; let mut pwd = paths . next ( ) . unwrap_or_else ( | | basedir . clone ( ) ) ; let mut focused_path = None ; if cli . force_focus || pwd . is_file ( ) { focused_path = pwd . file_name ( ) . map ( | p | p . into ( ) ) ; pwd = pwd . parent ( ) . map ( | p | p . into ( ) ) . unwrap_or ( basedir ) ; } Ok ( Self { pwd , focused_path , config_file : cli . config , extra_config_files : cli . extra_config , on_load : cli . on_load , read_only : cli . read_only , selection : paths . collect ( ) , } ) }
Create a new runner object passing the given arguments
Create a new runner object passing the given arguments
cli
Cli