diff --git a/tui/src/command.rs b/tui/src/command.rs index d3daa47..ee05874 100644 --- a/tui/src/command.rs +++ b/tui/src/command.rs @@ -6,6 +6,7 @@ pub enum Command { Help, // Picking based on id Channel(u64), + ListChannel, // app only lists if the cache has an active server // Choose server based on hostname Server(String), // List out available hosts @@ -45,7 +46,7 @@ impl Command { } } - pub fn from(s: String) -> Command { + pub fn from(s: &str) -> Command { let s = s.trim(); // NOTE: could probably do this smarter but a handful of string comparisons is fine too if s.starts_with("/chan") { @@ -60,8 +61,10 @@ impl Command { } } else if s.starts_with("/help") { Command::Help - } else if s.starts_with("/lh") { + } else if s.starts_with("/lh") || s.starts_with("/listhost") { Command::ListHost + } else if s.starts_with("/lc") || s.starts_with("/listchan") { + Command::ListChannel } else { if s.starts_with("/") { @@ -89,9 +92,9 @@ impl Command { bold!("! /lh"), ]), Message(msg) => Spans::from(vec![ - bold!("(You) "), - normal!(msg) + bold!("(You) "), normal!(msg) ]), + ListChannel => Spans::from(vec![normal!("/lc - list out (text)channels in server")]), Failure(msg) => Spans::from(vec![ bold!("! error "), normal!(msg)