pub fn new_with_dir<T>(arguments: ArgMatches, dir: T) -> Context
    where
        T: Into<PathBuf>,
    {
        let config = StarshipConfig::initialize();

        // Unwrap the clap arguments into a simple hashtable
        // we only care about single arguments at this point, there isn't a
        // use-case for a list of arguments yet.
        let properties: HashMap<&str, std::string::String> = arguments
            .args
            .iter()
            .filter(|(_, v)| !v.vals.is_empty())
            .map(|(a, b)| (*a, b.vals.first().cloned().unwrap().into_string().unwrap()))
            .collect();

        // TODO: Currently gets the physical directory. Get the logical directory.
        let current_dir = Context::expand_tilde(dir.into());

        let shell = Context::get_shell();

        Context {
            config,
            properties,
            current_dir,
            dir_contents: OnceCell::new(),
            repo: OnceCell::new(),
            shell,
            env: HashMap::new(),
        }
    }
/// Create a new instance of Context for the provided directory
Create a new instance of Context for the provided directory
Create a new instance of Context for the provided directory
pub fn new_with_dir<T>(arguments: ArgMatches, dir: T) -> Context
    where
        T: Into<PathBuf>,
    {
        let config = StarshipConfig::initialize();
        // Unwrap the clap arguments into a simple hashtable
        // we only care about single arguments at this point, there isn't a
        // use-case for a list of arguments yet.
        let properties: HashMap<&str, std::string::String> = arguments
            .args
            .iter()
            .filter(|(_, v)| !v.vals.is_empty())
            .map(|(a, b)| (*a, b.vals.first().cloned().unwrap().into_string().unwrap()))
            .collect();
        // TODO: Currently gets the physical directory. Get the logical directory.
        let current_dir = Context::expand_tilde(dir.into());
        let shell = Context::get_shell();
        Context {
            config,
            properties,
            current_dir,
            dir_contents: OnceCell::new(),
            repo: OnceCell::new(),
            shell,
            env: HashMap::new(),
        }
    }
pub fn new_with_dir < T > ( arguments : ArgMatches , dir : T ) -> Context where T : Into < PathBuf > , { let config = StarshipConfig :: initialize ( ) ; // Unwrap the clap arguments into a simple hashtable // we only care about single arguments at this point, there isn't a // use-case for a list of arguments yet. let properties : HashMap < & str , std :: string :: String > = arguments . args . iter ( ) . filter ( | ( _ , v ) | ! v . vals . is_empty ( ) ) . map ( | ( a , b ) | ( * a , b . vals . first ( ) . cloned ( ) . unwrap ( ) . into_string ( ) . unwrap ( ) ) ) . collect ( ) ; // TODO: Currently gets the physical directory. Get the logical directory. let current_dir = Context :: expand_tilde ( dir . into ( ) ) ; let shell = Context :: get_shell ( ) ; Context { config , properties , current_dir , dir_contents : OnceCell :: new ( ) , repo : OnceCell :: new ( ) , shell , env : HashMap :: new ( ) , } }
Create a new instance of Context for the provided directory
Create a new instance of Context for the provided directory
arguments
ArgMatches
dir
T