diff options
author | Akshay <[email protected]> | 2020-07-21 16:03:22 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2020-07-21 16:03:22 +0100 |
commit | 4f76460efa869317bd7065b4770c16d0146a92da (patch) | |
tree | 5578cfaec148888d00f44e1fe3c409681464bc61 /src/app | |
parent | 0eada5a463c0fe216cec69e96bf2ee05ad54a661 (diff) |
add help command
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/impl_self.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/app/impl_self.rs b/src/app/impl_self.rs index 2450bff..95f1871 100644 --- a/src/app/impl_self.rs +++ b/src/app/impl_self.rs | |||
@@ -230,6 +230,29 @@ impl App { | |||
230 | Command::TrackDown(name) => { | 230 | Command::TrackDown(name) => { |
231 | _track(&name, TrackEvent::Decrement); | 231 | _track(&name, TrackEvent::Decrement); |
232 | } | 232 | } |
233 | Command::Help(input) => { | ||
234 | if let Some(topic) = input.as_ref().map(String::as_ref) { | ||
235 | self.message.set_message( | ||
236 | match topic { | ||
237 | "a" | "add" => "add <habit-name> [goal] (alias: a)", | ||
238 | "aa" | "add-auto" => "add-auto <habit-name> [goal] (alias: aa)", | ||
239 | "d" | "delete" => "delete <habit-name> (alias: d)", | ||
240 | "mprev" | "month-prev" => "month-prev (alias: mprev)", | ||
241 | "mnext" | "month-next" => "month-next (alias: mnext)", | ||
242 | "tup" | "track-up" => "track-up <auto-habit-name> (alias: tup)", | ||
243 | "tdown" | "track-down" => "track-down <auto-habit-name> (alias: tdown)", | ||
244 | "q" | "quit" => "quit", | ||
245 | "h"|"?" | "help" => "help [<command>|commands|keys] (aliases: h, ?)", | ||
246 | "cmds" | "commands" => "add, add-auto, delete, month-{prev,next}, track-{up,down}, help, quit", | ||
247 | "keys" => "TODO", // TODO (view?) | ||
248 | _ => "unknown command or help topic.", | ||
249 | } | ||
250 | ) | ||
251 | } else { | ||
252 | // TODO (view?) | ||
253 | self.message.set_message("help <command>|commands|keys") | ||
254 | } | ||
255 | } | ||
233 | Command::Quit => self.save_state(), | 256 | Command::Quit => self.save_state(), |
234 | Command::MonthNext => self.sift_forward(), | 257 | Command::MonthNext => self.sift_forward(), |
235 | Command::MonthPrev => self.sift_backward(), | 258 | Command::MonthPrev => self.sift_backward(), |