diff options
author | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-11-25 18:39:04 -0800 |
---|---|---|
committer | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-11-25 18:39:04 -0800 |
commit | e4925f0311574cd954909695bb587902179f8680 (patch) | |
tree | bdd9e3eef0496018be29635a72aba26b0fc1bb64 /src/commands/profile.rs | |
parent | d626ae08cdfe8d1cbae3fdd0ccc9827d4691718e (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/profile.rs')
-rw-r--r-- | src/commands/profile.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/commands/profile.rs b/src/commands/profile.rs index c0d5d79..e20859b 100644 --- a/src/commands/profile.rs +++ b/src/commands/profile.rs @@ -1,3 +1,4 @@ +use display::DisplayInfo; use tw; use std; use std::collections::HashMap; @@ -14,12 +15,12 @@ pub static PROFILE: Command = Command { help_str: "Switch to profile <profile_name>" }; -fn switch_profile(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) { +fn switch_profile(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer, display_info: &mut DisplayInfo) { let profile_name = line.trim(); if tweeter.profiles.contains_key(profile_name) { tweeter.curr_profile = Some(profile_name.to_owned()); } else { - tweeter.display_info.status(format!("No profile named {}", profile_name)) + display_info.status(format!("No profile named {}", profile_name)) }; } @@ -31,8 +32,8 @@ pub static PROFILES: Command = Command { help_str: "List all profiles" }; -fn list_profiles(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) { - tweeter.display_info.recv(::display::Infos::Text( +fn list_profiles(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer, display_info: &mut DisplayInfo) { + display_info.recv(::display::Infos::Text( tweeter.profiles.keys().map(|key| key.to_owned()).collect() )); } |