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/follow.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/follow.rs')
-rw-r--r-- | src/commands/follow.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/commands/follow.rs b/src/commands/follow.rs index 6e29788..bc767d5 100644 --- a/src/commands/follow.rs +++ b/src/commands/follow.rs @@ -1,3 +1,4 @@ +use display::DisplayInfo; use tw; use ::Queryer; @@ -14,7 +15,7 @@ pub static UNFOLLOW: Command = Command { help_str: "Unfollow <handle>. No @ prefix in <handle>!" }; -fn unfl(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) { +fn unfl(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer, display_info: &mut DisplayInfo) { let screen_name = line.trim(); let result = match tweeter.current_profile() { Some(user_profile) => { @@ -24,7 +25,7 @@ fn unfl(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) { }; match result { Ok(_resp) => (), - Err(e) => tweeter.display_info.status(format!("unfl request error: {}", e)) + Err(e) => display_info.status(format!("unfl request error: {}", e)) } } @@ -36,11 +37,11 @@ pub static FOLLOW: Command = Command { help_str: "Follow <handle>. No @ prefix in <handle>!" }; -fn fl(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) { +fn fl(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer, display_info: &mut DisplayInfo) { let screen_name = line.trim(); match tweeter.current_profile().map(|profile| profile.to_owned()) { Some(user_profile) => { - tweeter.display_info.status( + display_info.status( format!( "fl resp: {:?}", queryer.do_api_post( @@ -51,6 +52,6 @@ fn fl(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) { ) ) }, - None => tweeter.display_info.status("No logged in user to follow from".to_owned()) + None => display_info.status("No logged in user to follow from".to_owned()) }; } |