aboutsummaryrefslogtreecommitdiff
path: root/src/display
diff options
context:
space:
mode:
authorAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-11 03:33:40 -0800
committerAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-11 03:33:40 -0800
commit3601bf6433d46dea4dd1960f7a3cdc514602983d (patch)
tree5d7d057480b0dc186311cd729f7a2c514a8c52eb /src/display
parent44b4d324a0176033107789d1421549b24898ac8a (diff)
move id formatting into a Display impl
Diffstat (limited to 'src/display')
-rw-r--r--src/display/mod.rs27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/display/mod.rs b/src/display/mod.rs
index 92fa9dd..0eeba68 100644
--- a/src/display/mod.rs
+++ b/src/display/mod.rs
@@ -363,12 +363,13 @@ pub fn render_twete(twete_id: &TweetId, tweeter: &mut tw::TwitterCache) -> Vec<S
let rt = tweeter.retrieve_tweet(&TweetId::Twitter(rt_id.to_owned())).unwrap().clone();
// and its author
let rt_author = tweeter.retrieve_user(&rt.author_id).unwrap().clone();
- result.push(format!("{} id:{} (rt_id:{}){}{}",
+ result.push(format!("{} id {} (rt id {}){}{}",
id_color, rt.internal_id, twete.internal_id,
rt.reply_to_tweet.clone()
- .map(|id| tweeter.retrieve_tweet(&TweetId::Twitter(id.to_owned()))
- .and_then(|tw| Some(format!(" reply_to:{}", tw.internal_id)))
- .unwrap_or(format!(" reply_to:twitter::{}", id))
+ .map(|id_str| TweetId::Twitter(id_str.to_owned()))
+ .map(|id| tweeter.retrieve_tweet(&id)
+ .and_then(|tw| Some(format!(" reply to {}", tw.internal_id)))
+ .unwrap_or(format!(" reply to {}", id))
)
.unwrap_or("".to_string()),
color::Fg(color::Reset)
@@ -381,12 +382,13 @@ pub fn render_twete(twete_id: &TweetId, tweeter: &mut tw::TwitterCache) -> Vec<S
));
}
None => {
- result.push(format!("{} id:{}{}{}",
+ result.push(format!("{} id {}{}{}",
id_color, twete.internal_id,
twete.reply_to_tweet.clone()
- .map(|id| tweeter.retrieve_tweet(&TweetId::Twitter(id.to_owned()))
- .and_then(|tw| Some(format!(" reply_to:{}", tw.internal_id)))
- .unwrap_or(format!(" reply_to:twitter::{}", id))
+ .map(|id_str| TweetId::Twitter(id_str.to_owned()))
+ .map(|id| tweeter.retrieve_tweet(&id)
+ .and_then(|tw| Some(format!(" reply to {}", tw.internal_id)))
+ .unwrap_or(format!(" reply to {}", id))
)
.unwrap_or("".to_string()),
color::Fg(color::Reset)
@@ -406,12 +408,13 @@ pub fn render_twete(twete_id: &TweetId, tweeter: &mut tw::TwitterCache) -> Vec<S
let maybe_qt = tweeter.retrieve_tweet(&TweetId::Twitter(qt_id.to_owned())).map(|x| x.to_owned());
if let Some(qt) = maybe_qt {
let qt_author = tweeter.retrieve_user(&qt.author_id).unwrap().clone();
- result.push(format!("{} id:{}{}{}",
+ result.push(format!("{} id {}{}{}",
id_color, qt.internal_id,
qt.reply_to_tweet.clone()
- .map(|id| tweeter.retrieve_tweet(&TweetId::Twitter(id.to_owned()))
- .and_then(|tw| Some(format!(" reply_to:{}", tw.internal_id)))
- .unwrap_or(format!(" reply_to:twitter::{}", id))
+ .map(|id_str| TweetId::Twitter(id.to_owned()))
+ .map(|id| tweeter.retrieve_tweet(&id)
+ .and_then(|tw| Some(format!(" reply to {}", tw.internal_id)))
+ .unwrap_or(format!(" reply to {}", id))
)
.unwrap_or("".to_string()),
color::Fg(color::Reset)