- Adding listhost + listchan command variants
This commit is contained in:
parent
939ee8c73f
commit
5ab2c961f6
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user