fixed separators being printed with quotes
This commit is contained in:
@@ -27,10 +27,10 @@ pub fn parse_config_file(input: &String) -> std::io::Result<std::collections::Ha
|
||||
// println!("error in line'", line);
|
||||
continue;
|
||||
}
|
||||
//// clean up value: remove quotes.. TODO:
|
||||
//let mut options: Vec<&str> = tokens[1].split(['\'', '\"']).collect::<Vec<&str>>().join(',');
|
||||
// clean up value: remove quotes.. TODO:
|
||||
let option = tokens[1].replace(&['\"', '\''][..], "");
|
||||
|
||||
config.insert(tokens[0].to_string(), tokens[1].to_string());
|
||||
config.insert(tokens[0].to_string(), option);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ pub fn gen_config_assignments(fields: &Punctuated<Field, Comma>, config_map_name
|
||||
Ok(parsed) => {
|
||||
parsed
|
||||
},
|
||||
// TODO: implement warnings about errors here
|
||||
Err(_) => {
|
||||
self.#name.clone()
|
||||
},
|
||||
|
||||
+5
-10
@@ -2,12 +2,12 @@
|
||||
//! in said config file
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::env::var;
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
use std::io::{Error, Result};
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use dirs::config_dir;
|
||||
|
||||
use super::config::*;
|
||||
use config_parser::{make_padding_string, apply_format};
|
||||
@@ -28,17 +28,12 @@ impl Bookmarks {
|
||||
bookmarks: HashMap::<String, PathBuf>::new(),
|
||||
};
|
||||
// get home directory path
|
||||
let home_dir = match var("HOME") {
|
||||
Ok(value) => value,
|
||||
Err(error) => return Err(Error::other(error.to_string())),
|
||||
};
|
||||
// create PathBuf object from home dir path
|
||||
bookmarks.conf_dir = match PathBuf::from_str(&home_dir) {
|
||||
Ok(value) => value,
|
||||
Err(error) => return Err(Error::other(error.to_string())),
|
||||
bookmarks.conf_dir = match config_dir() {
|
||||
Some(value) => value,
|
||||
None => return Err(Error::other("-- failed to find configuration directory")),
|
||||
};
|
||||
// expand home directory path to get configuration directory path
|
||||
bookmarks.conf_dir.push(".config/navigate/");
|
||||
bookmarks.conf_dir.push("navigate/");
|
||||
bookmarks.build_bookmarks()?;
|
||||
|
||||
Ok(bookmarks)
|
||||
|
||||
@@ -9,8 +9,6 @@ use std::io::{Error, Result};
|
||||
use std::path::PathBuf;
|
||||
use config_parser::*;
|
||||
|
||||
use crate::debug::debug_print;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Config {
|
||||
conf_file: PathBuf,
|
||||
|
||||
Reference in New Issue
Block a user