aboutsummaryrefslogtreecommitdiff
path: root/src/commands/show_cache.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2017-10-02 01:27:08 -0700
committeriximeow <me@iximeow.net>2017-10-02 01:27:18 -0700
commit781981f333345482e93ed35453e98e519bb7cc5e (patch)
tree08cfbcc32b9fbea5f13fd3447026090f51402274 /src/commands/show_cache.rs
parent081c0732b87383e3876fd6c60417f15830554174 (diff)
move everything to src/
Diffstat (limited to 'src/commands/show_cache.rs')
-rw-r--r--src/commands/show_cache.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/commands/show_cache.rs b/src/commands/show_cache.rs
new file mode 100644
index 0000000..3c31697
--- /dev/null
+++ b/src/commands/show_cache.rs
@@ -0,0 +1,31 @@
+use tw;
+use ::Queryer;
+
+use commands::Command;
+
+pub static SHOW_CACHE: Command = Command {
+ keyword: "show_cache",
+ params: 0,
+ exec: show_cache
+};
+
+fn show_cache(line: String, tweeter: &mut tw::TwitterCache, mut queryer: &mut Queryer) {
+ println!("----* USERS *----");
+ for (uid, user) in &tweeter.users {
+ println!("User: {} -> {:?}", uid, user);
+ }
+ println!("----* TWEETS *----");
+ for (tid, tweet) in &tweeter.tweets {
+ println!("Tweet: {} -> {:?}", tid, tweet);
+ }
+ println!("----* FOLLOWERS *----");
+ for uid in &tweeter.followers.clone() {
+ let user_res = tweeter.fetch_user(uid, &mut queryer);
+ match user_res {
+ Some(user) => {
+ println!("Follower: {} - {:?}", uid, user);
+ }
+ None => { println!(" ..."); }
+ }
+ }
+}