aboutsummaryrefslogtreecommitdiff
path: root/commands/view.rs
diff options
context:
space:
mode:
authorAndy Wortman <ixineeringeverywhere@gmail.com>2017-10-01 20:55:15 -0700
committerAndy Wortman <ixineeringeverywhere@gmail.com>2017-10-01 20:55:15 -0700
commite6ebf2c99a70bd5ee4e8d07097e6b128c3630714 (patch)
tree476947a6f2937737bc69ca073a2519bd9f15b1fe /commands/view.rs
parentaf67981a2a1c28b3b5598f74d48bfd3a7490c91a (diff)
extract commands and twitter model into modules
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);
+}