Added global config directory

+ Should be platform independent thanks to platform-dirs
+ All config files in the directory are used
+ Some optimizations could be made so now all config files are loaded.
+ clippy + fmt
This commit is contained in:
joeyahines committed 2022-05-03 20:11:54 -06:00
1 parent ace4b9aa10
commit 5a98f84063
5 files changed
+179 -28

No files matched your search

+10 -1
View File
@@ -22,6 +22,15 @@ pub struct Args {
)]
config: Option<PathBuf>,
#[structopt(
short = "g",
long = "global_config",
env = "FORMATY_GLOBAL_CONFIG",
parse(from_os_str),
help = "Path to the global config directory"
)]
global_config: Option<PathBuf>,
#[structopt(
help = "Input data type",
short = "i",
@@ -43,7 +52,7 @@ pub struct Args {
fn init() -> Result<(Vec<u8>, Format), FormatyError> {
let args: Args = Args::from_args();
let config = FormatConfig::new(&args.config)?;
let config = FormatConfig::new(&args.config, &args.global_config)?;
let format = config.get_format(&args.format)?;