diff --git a/Cargo.lock b/Cargo.lock index 716d5ed..3865f10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -141,6 +141,15 @@ dependencies = [ "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "directories" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "dtoa" version = "0.4.3" @@ -1309,6 +1318,7 @@ dependencies = [ name = "whoareyou" version = "0.1.0" dependencies = [ + "directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", "scraper 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1369,6 +1379,7 @@ dependencies = [ "checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" "checksum cssparser 0.24.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b200a7193703a615c8d2751fed1ede39b9c4b3905e09d1ec7064a24688c190fc" "checksum cssparser-macros 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b16e382d9b983fdb9ac6a36b37fdeb84ce3ea81f749febfee3463cfa7f24275e" +"checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f" "checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" "checksum dtoa-short 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "59020b8513b76630c49d918c33db9f4c91638e7d3404a28084083b87e33f76f2" "checksum ego-tree 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9733f6ada1734cb25b4033b2855ec78feb267971a2dd76012974906ba8780074" diff --git a/Cargo.toml b/Cargo.toml index 4109fcd..0c2d7c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,5 +5,6 @@ authors = ["Anders Olsson "] edition = "2018" [dependencies] +directories = "1.0" reqwest = "0.9" scraper = "0.9" diff --git a/src/main.rs b/src/main.rs index 968d3bc..0cc08e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,10 @@ use std::env; +use directories::ProjectDirs; use scraper::{Html, Selector}; trait Probe { - fn search(&mut self, number: &str); + fn search(&mut self, _: &str); } // https://www.hitta.se/vem-ringde/{} @@ -63,7 +64,33 @@ impl Probe for KonsumentInfo { fn search(&mut self, _: &str) {} } +struct Context { + dirs: ProjectDirs, +} + +impl Context { + fn new() -> Context { + Context { + dirs: ProjectDirs::from("com", "logaritmisk", "whoareyou").unwrap(), + } + } + + fn cache_get(&mut self, key: &str) -> Option> { + None + } + + fn cache_set(&mut self, key: &str) { + + } +} + fn main() { + if let Some(proj_dirs) = ProjectDirs::from("com", "logaritmisk", "whoareyou") { + println!("{:?}", proj_dirs.cache_dir()); + } + + std::process::exit(0); + let number = env::args() .nth(1) .expect("must specify a number to search for");