super_cereal 0.1.0

Proxy a serial port over the network using RustDDS (UART over LAN)
use clap::{Parser, Subcommand};
use std::path::PathBuf;

#[derive(Parser, Debug)]
#[command(
    name = "super_cereal",
    about = "Proxy a serial port over the network via RustDDS"
)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Commands,
}

#[derive(Subcommand, Debug)]
pub enum Commands {
    /// Expose a local serial port on the network
    Serve {
        /// Serial device path (e.g. /dev/ttyACM0)
        #[arg(short, long)]
        port: PathBuf,

        /// Baud rate
        #[arg(short, long, default_value_t = 115_200)]
        baud: u32,

        /// Channel name advertised on the LAN
        #[arg(short, long)]
        channel: String,

        /// DDS domain id
        #[arg(short, long, default_value_t = 0)]
        domain: u16,
    },

    /// Attach to a remote serial channel via a local PTY symlink
    Attach {
        /// Channel name to attach to
        #[arg(short, long)]
        channel: String,

        /// Stable symlink path for the virtual serial device
        #[arg(short, long)]
        link: PathBuf,

        /// DDS domain id
        #[arg(short, long, default_value_t = 0)]
        domain: u16,
    },

    /// List serial channels discovered on the LAN
    List {
        /// DDS domain id
        #[arg(short, long, default_value_t = 0)]
        domain: u16,

        /// Seconds to wait for discovery before listing
        #[arg(long, default_value_t = 3)]
        wait: u64,
    },
}