aboutsummaryrefslogtreecommitdiff
path: root/commands/view.rs
diff options
context:
space:
mode:
Diffstat (limited to 'commands/view.rs')
-rw-r--r--commands/view.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/commands/view.rs b/commands/view.rs
new file mode 100644
index 0000000..1470f90
--- /dev/null
+++ b/commands/view.rs
@@ -0,0 +1,20 @@
+use tw;
+use ::Queryer;
+
+use commands::Command;
+
+use std::str::FromStr;
+
+pub static VIEW: Command = Command {
+ keyword: "view",
+ params: 1,
+ exec: view
+};
+
+fn view(line: String, tweeter: &mut tw::TwitterCache, _queryer: &mut Queryer) {
+ // TODO handle this unwrap
+ let inner_twid = u64::from_str(&line).unwrap();
+ let twete = tweeter.tweet_by_innerid(inner_twid).unwrap();
+ ::render_twete(&twete.id, tweeter);
+ println!("link: https://twitter.com/i/web/status/{}", twete.id);
+}