Add "migrate" command

This commit is contained in:
Tobias Reisinger 2025-01-09 18:10:58 +01:00
parent 3463907670
commit 21c1e3fbb3
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
3 changed files with 32 additions and 0 deletions

View file

@ -17,6 +17,7 @@ struct Cli {
#[derive(Subcommand)]
pub enum Commands {
Info,
Channels(ChannelsArgs),
Clients,
Fetch(FetchArgs),

View file

@ -47,6 +47,26 @@ fn main() -> Result<(), Error> {
// You can check for the existence of subcommands, and if found use their
// matches just as you would the top level cmd
match cli {
Commands::Info => {
let client = match wrappers::find_self(&mut connection) {
Ok(client) => client,
Err(msg) => return Err(make_action_error("find self", msg))
};
let channel_name: String = match wrappers::find_channel(&mut connection, "cid", &client.cid.to_string(), true) {
Ok(channel) => match channel {
Some(channel) => channel.channel_name,
None => return Err(to_other_error("Channel not found.".to_string()))
},
Err(msg) => return Err(make_action_error("find self", msg))
};
println!("Client: {}", client.client_nickname);
println!("Channel: {}", channel_name);
println!("Channel ID: {}", client.cid);
println!("Client ID: {}", client.clid);
}
Commands::Channels(args) => {
match wrappers::get_channels(&mut connection, args.spacers) {
Ok(channels) => {