From 5ab2c961f66deb52b175bc8f0dfd0dfb58014be8 Mon Sep 17 00:00:00 2001 From: shockrah Date: Mon, 5 Apr 2021 17:00:59 -0700 Subject: [PATCH] - Adding listhost + listchan command variants --- tui/src/command.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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)