pub fn new<T: AsRef<str>>(name: T) -> Result<Self> {
        let mut path = match dirs::config_dir() {
            Some(data) => data,
            None => return Err(anyhow!("Couldn't get config path")),
        };

        path.push(format!("{}.yaml", name.as_ref()));

        let contents = match fs::read_to_string(&path) {
            Ok(data) => data,
            Err(_error) => {
                let temp: HashMap<String, String> = HashMap::new();

                let deserialized = serde_yaml::to_string(&temp)?;

                fs::write(&path, deserialized.as_bytes())?;

                deserialized
            }
        };

        let internal: HashMap<String, String> = serde_yaml::from_str(contents.as_str())?;

        let myself = Self{
            internal,
            path,
        };

        Ok(myself)
    }
/// Create a new system config.
Create a new system config.
Create a new system config .
pub fn new<T: AsRef<str>>(name: T) -> Result<Self> {
        let mut path = match dirs::config_dir() {
            Some(data) => data,
            None => return Err(anyhow!("Couldn't get config path")),
        };
        path.push(format!("{}.yaml", name.as_ref()));
        let contents = match fs::read_to_string(&path) {
            Ok(data) => data,
            Err(_error) => {
                let temp: HashMap<String, String> = HashMap::new();
                let deserialized = serde_yaml::to_string(&temp)?;
                fs::write(&path, deserialized.as_bytes())?;
                deserialized
            }
        };
        let internal: HashMap<String, String> = serde_yaml::from_str(contents.as_str())?;
        let myself = Self{
            internal,
            path,
        };
        Ok(myself)
    }
pub fn new < T : AsRef < str > > ( name : T ) -> Result < Self > { let mut path = match dirs :: config_dir ( ) { Some ( data ) => data , None => return Err ( anyhow ! ( " " ) ) , } ; path . push ( format ! ( " " name as_ref ( ) ) ) ; let contents = match fs :: read_to_string ( & path ) { Ok ( data ) => data , Err ( _error ) => { let temp : HashMap < String , String > = HashMap :: new ( ) ; let deserialized = serde_yaml :: to_string ( & temp ) ? ; fs :: write ( & path , deserialized . as_bytes ( ) ) ? ; deserialized } } ; let internal : HashMap < String , String > = serde_yaml :: from_str ( contents . as_str ( ) ) ? ; let myself = Self { internal , path , } ; Ok ( myself ) }
Create a new system config.
Create a new system config .
name
T