twixter

A twtxt command line client in Rust

git clone git://git.shimmy1996.com/twixter.git
commit 634d7d136b842ea68d038370e7abb9187c727562
parent 9d3c3b743246a484d4b0f049208ac4c9c3574c5a
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Tue,  3 Sep 2019 09:48:22 -0400

Accept Config Overrides

Diffstat:
Msrc/main.rs | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/main.rs b/src/main.rs
@@ -72,8 +72,17 @@ fn main() {
         .get_matches();
 
     // Source config.
-    let mut config_dir = dirs::config_dir().unwrap();
-    config_dir.push("twixter/config");
+    let mut config_dir = command
+        .args
+        .get("config_dir")
+        .and_then(|matched_arg| Some(Path::new(&matched_arg.vals[0]).to_path_buf()))
+        .unwrap_or({
+            let mut config_dir = dirs::config_dir().unwrap();
+            config_dir.push("twixter");
+            config_dir
+        });
+    config_dir.push("config");
+
     let config = Config::new(&config_dir);
 
     // Check if twtfile exists and create one if necessary.