Added message + listen commands

This commit is contained in:
2026-05-31 14:15:59 -07:00
parent 0f36ee454e
commit bcd9f1992d
3 changed files with 41 additions and 7 deletions
+12 -2
View File
@@ -30,7 +30,7 @@ pub struct Args {
pub verbose: u8,
}
#[derive(Subcommand,Debug)]
#[derive(Subcommand,Debug,Clone)]
pub enum Command {
CreateUser {
#[clap(short, long)]
@@ -50,6 +50,12 @@ pub enum Command {
#[clap(short, long, value_parser=Room::from_str)]
room: Room,
},
GetMessages {
#[clap(short, long, default_value_t = 100)]
count: u64,
#[clap(value_parser=Room::from_str)]
room: Room
},
Join {
#[clap(value_parser=Room::from_str)]
room: Room,
@@ -63,7 +69,7 @@ pub enum Command {
room: Room,
},
Listen {
#[clap(short, long, value_parser=Room::from_str)]
#[clap(value_parser=Room::from_str)]
room: Room,
},
Upload {
@@ -123,6 +129,10 @@ impl Command {
Listen {
room,
} => (ClientMessage::SubscribeMessages{room_id: room.get_coord()},room.get_server()),
GetMessages {
room,
count
} => (ClientMessage::FetchMessages{room_id: room.get_coord(), count, end: fedichat::message::MessageId(i64::MAX as u64)},room.get_server()),
Join {
room,
} => (ClientMessage::RoomJoin{room_id: room.get_coord()},room.get_server()),