Some refactoring

- move example config to `examples/` so we can test erroring out when no config is found
- move `read_config` to `Config::read`
2 files changed, 12 insertions(+), 11 deletions(-)

M choosier.toml => examples/choosier.toml
M src/main.rs
M choosier.toml => examples/choosier.toml +0 -0

        
M src/main.rs +12 -11
@@ 52,18 52,19 @@ impl Config {
         let config: Config = toml::from_str(&config_str)?;
         Ok(config)
     }
+
+    fn read() -> Result<String, io::Error> {
+        use std::fs::File;
+        use std::io::prelude::*;
+
+        let cfg_path = Config::locate()?;
+        let mut file = File::open(cfg_path)?;
+        let mut contents = String::new();
+        file.read_to_string(&mut contents)?;
+        Ok(contents)
+    }
 }
 
-fn read_config() -> Result<String, io::Error> {
-    use std::fs::File;
-    use std::io::prelude::*;
-
-    let cfg_path = Config::locate()?;
-    let mut file = File::open(cfg_path)?;
-    let mut contents = String::new();
-    file.read_to_string(&mut contents)?;
-    Ok(contents)
-}
 
 
 fn open_url(url: &str, config: Config) {

          
@@ 101,7 102,7 @@ fn main() {
     }
     let url = &args[1];
 
-    let config_str = read_config().expect("Unable to read configuration file");
+    let config_str = Config::read().expect("Unable to read configuration file");
     let config = Config::parse(&config_str).expect("Unable to parse configuration");
     open_url(url, config);
 }