- Adding listhost + listchan command variants
This commit is contained in:
parent
939ee8c73f
commit
5ab2c961f6
@ -6,6 +6,7 @@ pub enum Command {
|
|||||||
Help,
|
Help,
|
||||||
// Picking based on id
|
// Picking based on id
|
||||||
Channel(u64),
|
Channel(u64),
|
||||||
|
ListChannel, // app only lists if the cache has an active server
|
||||||
// Choose server based on hostname
|
// Choose server based on hostname
|
||||||
Server(String),
|
Server(String),
|
||||||
// List out available hosts
|
// 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();
|
let s = s.trim();
|
||||||
// NOTE: could probably do this smarter but a handful of string comparisons is fine too
|
// NOTE: could probably do this smarter but a handful of string comparisons is fine too
|
||||||
if s.starts_with("/chan") {
|
if s.starts_with("/chan") {
|
||||||
@ -60,8 +61,10 @@ impl Command {
|
|||||||
}
|
}
|
||||||
} else if s.starts_with("/help") {
|
} else if s.starts_with("/help") {
|
||||||
Command::Help
|
Command::Help
|
||||||
} else if s.starts_with("/lh") {
|
} else if s.starts_with("/lh") || s.starts_with("/listhost") {
|
||||||
Command::ListHost
|
Command::ListHost
|
||||||
|
} else if s.starts_with("/lc") || s.starts_with("/listchan") {
|
||||||
|
Command::ListChannel
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if s.starts_with("/") {
|
if s.starts_with("/") {
|
||||||
@ -89,9 +92,9 @@ impl Command {
|
|||||||
bold!("! /lh"),
|
bold!("! /lh"),
|
||||||
]),
|
]),
|
||||||
Message(msg) => Spans::from(vec![
|
Message(msg) => Spans::from(vec![
|
||||||
bold!("(You) "),
|
bold!("(You) "), normal!(msg)
|
||||||
normal!(msg)
|
|
||||||
]),
|
]),
|
||||||
|
ListChannel => Spans::from(vec![normal!("/lc - list out (text)channels in server")]),
|
||||||
Failure(msg) => Spans::from(vec![
|
Failure(msg) => Spans::from(vec![
|
||||||
bold!("! error "),
|
bold!("! error "),
|
||||||
normal!(msg)
|
normal!(msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user