aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands/auth.rs4
-rw-r--r--src/commands/fav.rs6
-rw-r--r--src/commands/follow.rs6
-rw-r--r--src/commands/help.rs1
-rw-r--r--src/commands/look_up.rs6
-rw-r--r--src/commands/mod.rs1
-rw-r--r--src/commands/quit.rs1
-rw-r--r--src/commands/show_cache.rs1
-rw-r--r--src/commands/thread.rs7
-rw-r--r--src/commands/twete.rs14
-rw-r--r--src/commands/view.rs7
-rw-r--r--src/main.rs22
12 files changed, 59 insertions, 17 deletions
diff --git a/src/commands/auth.rs b/src/commands/auth.rs
index 0a2425d..7d01451 100644
--- a/src/commands/auth.rs
+++ b/src/commands/auth.rs
@@ -15,6 +15,7 @@ pub static AUTH: Command = Command {
keyword: "auth",
params: 0,
exec: auth,
+ param_str: "",
// TODO: support account-specific auth? profile name spec?
help_str: "Begin PIN-based account auth process. Second step is the `pin` command."
};
@@ -57,7 +58,8 @@ pub static PIN: Command = Command {
keyword: "pin",
params: 1,
exec: pin,
- help_str: "<PIN>: Complete account auth. Enter PIN from prior `auth` link to connect an account."
+ param_str: " <PIN>",
+ help_str: "Complete account auth. Enter PIN from prior `auth` link to connect an account."
};
fn pin(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
diff --git a/src/commands/fav.rs b/src/commands/fav.rs
index 6f769d3..7a4852e 100644
--- a/src/commands/fav.rs
+++ b/src/commands/fav.rs
@@ -12,7 +12,8 @@ pub static UNFAV: Command = Command {
keyword: "unfav",
params: 1,
exec: unfav,
- help_str: "<tweet_id>: Unfavorite a tweet."
+ param_str: " <tweet_id>",
+ help_str: "Unfavorite a tweet."
};
fn unfav(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
@@ -42,7 +43,8 @@ pub static FAV: Command = Command {
keyword: "fav",
params: 1,
exec: fav,
- help_str: "<tweet_id>: Favorite a tweet."
+ param_str: "<tweet_id>",
+ help_str: "Favorite a tweet."
};
fn fav(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
diff --git a/src/commands/follow.rs b/src/commands/follow.rs
index 3a53821..3a29252 100644
--- a/src/commands/follow.rs
+++ b/src/commands/follow.rs
@@ -10,7 +10,8 @@ pub static UNFOLLOW: Command = Command {
keyword: "unfl",
params: 1,
exec: unfl,
- help_str: "<handle>: Unfollow <handle>. No @ prefix in <handle>!"
+ param_str: " <handle>",
+ help_str: "Unfollow <handle>. No @ prefix in <handle>!"
};
fn unfl(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
@@ -31,7 +32,8 @@ pub static FOLLOW: Command = Command {
keyword: "fl",
params: 1,
exec: fl,
- help_str: "<handle>: Follow <handle>. No @ prefix in <handle>!"
+ param_str: " <handle>",
+ help_str: "Follow <handle>. No @ prefix in <handle>!"
};
fn fl(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
diff --git a/src/commands/help.rs b/src/commands/help.rs
index 825447b..c99681e 100644
--- a/src/commands/help.rs
+++ b/src/commands/help.rs
@@ -9,6 +9,7 @@ pub static HELP: Command = Command {
keyword: "help",
params: 0,
exec: help,
+ param_str: "",
help_str: "This help prompt."
};
diff --git a/src/commands/look_up.rs b/src/commands/look_up.rs
index fa83d2b..7bd5885 100644
--- a/src/commands/look_up.rs
+++ b/src/commands/look_up.rs
@@ -9,7 +9,8 @@ pub static LOOK_UP_USER: Command = Command {
keyword: "look_up_user",
params: 1,
exec: look_up_user,
- help_str: "<twitter_user_id>: Look up the user by the specified twitter user ID, display name/handle."
+ param_str: " <twitter_user_id>",
+ help_str: "Look up the user by the specified twitter user ID, display name/handle."
};
fn look_up_user(line: String, tweeter: &mut tw::TwitterCache, mut queryer: &mut Queryer) {
@@ -25,7 +26,8 @@ pub static LOOK_UP_TWEET: Command = Command {
keyword: "look_up_tweet",
params: 1,
exec: look_up_tweet,
- help_str: "<tweet_id>: Look up tweet by the tweet ID. If unknown, try to retrieve it."
+ param_str: " <tweet_id>",
+ help_str: "Look up tweet by the tweet ID. If unknown, try to retrieve it."
};
// TODO: make this parse a proper tweet id
diff --git a/src/commands/mod.rs b/src/commands/mod.rs
index f2160f9..e8efdb1 100644
--- a/src/commands/mod.rs
+++ b/src/commands/mod.rs
@@ -5,6 +5,7 @@ pub struct Command {
pub keyword: &'static str,
pub params: u8,
pub exec: fn(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer),
+ pub param_str: &'static str,
pub help_str: &'static str
}
diff --git a/src/commands/quit.rs b/src/commands/quit.rs
index dedeab6..6638299 100644
--- a/src/commands/quit.rs
+++ b/src/commands/quit.rs
@@ -9,6 +9,7 @@ pub static QUIT: Command = Command {
keyword: "q",
params: 0,
exec: quit,
+ param_str: "",
// TODO: app name
help_str: "Gracefully exit this thing"
};
diff --git a/src/commands/show_cache.rs b/src/commands/show_cache.rs
index a57b59f..fffcdb6 100644
--- a/src/commands/show_cache.rs
+++ b/src/commands/show_cache.rs
@@ -7,6 +7,7 @@ pub static SHOW_CACHE: Command = Command {
keyword: "show_cache",
params: 0,
exec: show_cache,
+ param_str: "",
help_str: "Dump all cached info. Probably a bad idea."
};
diff --git a/src/commands/thread.rs b/src/commands/thread.rs
index 0897b21..71d0e52 100644
--- a/src/commands/thread.rs
+++ b/src/commands/thread.rs
@@ -10,7 +10,8 @@ pub static FORGET_THREAD: Command = Command {
keyword: "forget",
params: 1,
exec: forget,
- help_str: "<name>: Discard thread known by <name>. Entirely local to the client."
+ param_str: " <name>",
+ help_str: "Discard thread known by <name>. Entirely local to the client."
};
fn forget(line: String, tweeter: &mut tw::TwitterCache, _queryer: &mut Queryer) {
@@ -22,7 +23,8 @@ pub static REMEMBER_THREAD: Command = Command {
keyword: "remember",
params: 2,
exec: remember,
- help_str: "<tweet_id> <name>: Remember the thread tipped by <tweet_id> as <name>. Entirely local to the client."
+ param_str: " <tweet_id> <name>",
+ help_str: "Remember the thread tipped by <tweet_id> as <name>. Entirely local to the client."
};
fn remember(line: String, tweeter: &mut tw::TwitterCache, _queryer: &mut Queryer) {
@@ -54,6 +56,7 @@ pub static LIST_THREADS: Command = Command {
keyword: "ls_threads",
params: 0,
exec: ls_threads,
+ param_str: "",
help_str: "Show all known (local) threads"
};
diff --git a/src/commands/twete.rs b/src/commands/twete.rs
index ff75fea..dbea81b 100644
--- a/src/commands/twete.rs
+++ b/src/commands/twete.rs
@@ -13,7 +13,8 @@ pub static DEL: Command = Command {
keyword: "del",
params: 1,
exec: del,
- help_str: "<tweet_id>: Delete tweet <tweet_id>"
+ param_str: " <tweet_id>",
+ help_str: "Delete tweet <tweet_id>"
};
fn del(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
@@ -43,6 +44,7 @@ pub static TWETE: Command = Command {
keyword: "t",
params: 0,
exec: twete,
+ param_str: "",
help_str: "Enter tweet compose mode."
};
@@ -79,6 +81,7 @@ pub static THREAD: Command = Command {
keyword: "thread",
params: 2,
exec: thread,
+ param_str: " <tweet_id> <response>", // should be optional..
// TODO: make it actually do this..
help_str: "Enter compose mode, appending to a thread"
};
@@ -122,8 +125,9 @@ pub static REP: Command = Command {
keyword: "rep",
params: 1,
exec: rep,
+ param_str: " <tweet_id>",
// TODO: doc immediate reply mode
- help_str: "<tweet_id>: Enter compose mode to reply to <tweet_id>"
+ help_str: "Enter compose mode to reply to <tweet_id>"
};
fn rep(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
@@ -199,7 +203,8 @@ pub static QUOTE: Command = Command {
keyword: "qt",
params: 2,
exec: quote,
- help_str: "<tweet_id> <text>: Quote <tweet_id> with context <text>"
+ param_str: " <tweet_id> <text>",
+ help_str: "Quote <tweet_id> with context <text>"
};
fn quote(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
@@ -259,7 +264,8 @@ pub static RETWETE: Command = Command {
keyword: "rt",
params: 1,
exec: retwete,
- help_str: "<tweet_id>: Retweet <tweet_id>"
+ param_str: " <tweet_id>",
+ help_str: "Retweet <tweet_id>"
};
fn retwete(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
diff --git a/src/commands/view.rs b/src/commands/view.rs
index a647391..15c94b1 100644
--- a/src/commands/view.rs
+++ b/src/commands/view.rs
@@ -11,7 +11,8 @@ pub static VIEW: Command = Command {
keyword: "view",
params: 1,
exec: view,
- help_str: "<tweet_id>: Display tweet <tweet_id> with a reference URL"
+ param_str: " <tweet_id>",
+ help_str: "Display tweet <tweet_id> with a reference URL"
};
fn view(line: String, tweeter: &mut tw::TwitterCache, _queryer: &mut Queryer) {
@@ -36,7 +37,8 @@ pub static VIEW_THREAD: Command = Command {
keyword: "view_tr",
params: 1,
exec: view_tr,
- help_str: "<tweet_id>: Display whole thread leading to <tweet_id>, reference URLs for each"
+ param_str: " <tweet_id>",
+ help_str: "Display whole thread leading to <tweet_id>, reference URLs for each"
};
fn view_tr(line: String, mut tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
@@ -67,6 +69,7 @@ pub static VIEW_THREAD_FORWARD: Command = Command {
keyword: "viewthread+",
params: 1,
exec: view_tr_forward,
+ param_str: "",
help_str: "help me make this work"
};
diff --git a/src/main.rs b/src/main.rs
index f2842c4..031ad37 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -381,9 +381,27 @@ fn do_ui(ui_rx_orig: chan::Receiver<Result<termion::event::Event, std::io::Error
match tweeter.state {
tw::AppState::ShowHelp => {
- let mut help_lines = vec![];
+ let mut help_lines: Vec<String> = vec![
+ " Tweets",
+ " ",
+ "Tweets are identified in four (really, three) ways:",
+ " twitter:1235 - there's no local copy for it, when you look it up I'll have to ask Twitter for it.",
+ // TODO:
+ " YYYYMMDD:NNNN - NNNN'th tweet on YYYYMMDD. Numbered as I got them, not by date tweet was made. For example, 20170803:NNNN. NOTE: not currently well supported. Don't even try to use.",
+ " :NNNN - NNNN'th tweet since the first I saw.",
+ // TODO:
+ " NNNN - NNNN'th tweet of today. Again, numbered by the order I saw it. NOTE: currently this isn't well supported. Use the :ID format above with the same number for now",
+ " (ex: you want to reply to a tweet `id 1234`, do `rep :1234`, with :, rather than without)",
+ " ",
+ "Tweets can be made immediately by providing the text as part of a command,",
+ " (like `t hello, world!`)",
+ "or in \"compose mode\" with relevant context shown. If you end up in compose mode and want to get back to a normal prompt, press escape.",
+ " ",
+ " Commands",
+ " "
+ ].into_iter().map(|x| x.to_owned()).collect();
for command in commands::COMMANDS {
- help_lines.push(format!("{} {}", command.keyword, command.help_str));
+ help_lines.push(format!("{}{: <width$} {}", command.keyword, command.param_str, command.help_str, width=(35 - command.keyword.len())));
}
tweeter.display_info.infos.push(display::Infos::Text(help_lines));
display::paint(tweeter).unwrap();