diff options
author | Sam Tay <sam.chong.tay@gmail.com> | 2020-07-09 22:24:49 -0700 |
---|---|---|
committer | Sam Tay <sam.chong.tay@gmail.com> | 2020-07-10 19:13:49 -0700 |
commit | 46e019ddf3b67a8307773edd109aa29d5be1a8b3 (patch) | |
tree | 4e7267978a99d3fedc4809223c4b67ed7663b1ff /src/main.rs | |
parent | 26f57de89cb9b903917f51af4ab5df9e287af1a4 (diff) |
Add hidden --print-config-path for debugging
And refactor config to put functions under Config implementation; this seems more Rustic, based on my limited experience looking at other codebases.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 2db6c99..48a73a4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,7 @@ use termimad::{CompoundStyle, MadSkin}; use tokio::runtime::Runtime; use tokio::task; +use config::Config; use error::{Error, Result}; use stackexchange::{LocalStorage, Question, Search}; use tui::markdown::Markdown; @@ -49,7 +50,11 @@ async fn run(skin: &mut MadSkin) -> Result<Option<Vec<Question<Markdown>>>> { let ls = LocalStorage::new(opts.update_sites).await?; if let Some(key) = opts.set_api_key { - config::set_api_key(key)?; + Config::set_api_key(key)?; + } + + if opts.print_config_path { + println!("{}", Config::config_file_path()?.display()); } if opts.list_sites { |