Add fetch-channel command
This commit is contained in:
parent
970c1ee2c2
commit
244a7073fe
9 changed files with 183 additions and 54 deletions
src
30
src/cli.rs
30
src/cli.rs
|
@ -31,7 +31,12 @@ pub struct ChannelsArgs {
|
|||
pub struct FetchArgs {
|
||||
#[arg(long)]
|
||||
strict_client: bool,
|
||||
client: String,
|
||||
#[arg(long)]
|
||||
strict_channel: bool,
|
||||
#[arg(long)]
|
||||
channel: Option<String>,
|
||||
#[arg(long)]
|
||||
client: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
|
@ -58,12 +63,29 @@ pub struct UpdateArgs {
|
|||
speakers: Option<bool>,
|
||||
}
|
||||
|
||||
|
||||
impl FetchArgs {
|
||||
pub fn client(&self, connection: &mut Telnet) -> Result<Option<ResponseClient>, String> {
|
||||
utils::find_client(connection, &self.client, self.strict_client)
|
||||
pub fn want_channel(&self) -> bool {
|
||||
self.channel.is_some()
|
||||
}
|
||||
|
||||
pub fn want_client(&self) -> bool {
|
||||
self.client.is_some()
|
||||
}
|
||||
|
||||
pub fn channel(&self, connection: &mut Telnet) -> Result<Option<ResponseChannel>, String> {
|
||||
if let Some(channel) = &self.channel {
|
||||
utils::find_channel(connection, channel, self.strict_channel)
|
||||
} else {
|
||||
Err("No channel specified.".to_string())
|
||||
}
|
||||
}
|
||||
pub fn client(&self, connection: &mut Telnet) -> Result<Option<ResponseClient>, String> {
|
||||
if let Some(client) = &self.client {
|
||||
utils::find_client(connection, client, self.strict_client)
|
||||
} else {
|
||||
Err("No client specified.".to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MoveArgs {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue