aboutsummaryrefslogtreecommitdiff
path: root/src/commands/show_cache.rs
diff options
context:
space:
mode:
authorAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-25 18:39:04 -0800
committerAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-25 18:39:04 -0800
commite4925f0311574cd954909695bb587902179f8680 (patch)
treebdd9e3eef0496018be29635a72aba26b0fc1bb64 /src/commands/show_cache.rs
parentd626ae08cdfe8d1cbae3fdd0ccc9827d4691718e (diff)
extract DisplayInfo from TwitterCache
what a mess... threading this through to any point where printing happens is upsetting. probably should be a global mutable behind accessors.
Diffstat (limited to 'src/commands/show_cache.rs')
-rw-r--r--src/commands/show_cache.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/commands/show_cache.rs b/src/commands/show_cache.rs
index 6dda8dc..2b810d7 100644
--- a/src/commands/show_cache.rs
+++ b/src/commands/show_cache.rs
@@ -1,3 +1,4 @@
+use display::DisplayInfo;
use tw;
use ::Queryer;
@@ -11,24 +12,24 @@ pub static SHOW_CACHE: Command = Command {
help_str: "Dump all cached info. Probably a bad idea."
};
-fn show_cache(_line: String, tweeter: &mut tw::TwitterCache, mut queryer: &mut Queryer) {
+fn show_cache(_line: String, tweeter: &mut tw::TwitterCache, mut queryer: &mut Queryer, display_info: &mut DisplayInfo) {
/*
- tweeter.display_info.status("----* USERS *----".to_owned());
+ display_info.status("----* USERS *----".to_owned());
for (uid, user) in &tweeter.users {
- tweeter.display_info.status(format!("User: {} -> {:?}", uid, user));
+ display_info.status(format!("User: {} -> {:?}", uid, user));
}
- tweeter.display_info.status("----* TWEETS *----".to_owned());
+ display_info.status("----* TWEETS *----".to_owned());
for (tid, tweet) in &tweeter.tweets {
- tweeter.display_info.status(format!("Tweet: {} -> {:?}", tid, tweet));
+ display_info.status(format!("Tweet: {} -> {:?}", tid, tweet));
}
- tweeter.display_info.status("----* FOLLOWERS *----".to_owned());
+ display_info.status("----* FOLLOWERS *----".to_owned());
for uid in &tweeter.followers.clone() {
let user_res = tweeter.fetch_user(uid, &mut queryer).map(|x| x.clone());
match user_res {
Some(user) => {
- tweeter.display_info.status(format!("Follower: {} - {:?}", uid, user));
+ display_info.status(format!("Follower: {} - {:?}", uid, user));
}
- None => { tweeter.display_info.status(" ...".to_owned()); }
+ None => { display_info.status(" ...".to_owned()); }
}
}
*/