From dfd5577cbc61f0460b300c69f183a461128cfaec Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Mon, 9 Dec 2024 20:20:56 +0100 Subject: [PATCH] Adds a name and a randid when saving a VP --- Cargo.toml | 1 + src/cli.rs | 8 ++++---- src/projector/mod.rs | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d5ea2ac..33d7486 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,7 @@ colog = "1.3.0" env_logger = "0.11.5" log = { version = "0.4.22", features = ["serde", "std", "release_max_level_debug", "max_level_debug"] } rand = { version = "0.8.5", features = ["small_rng"] } +mockall = "0.13.1" [[bin]] name = "rusty_midicommander" diff --git a/src/cli.rs b/src/cli.rs index 07c094a..1d170fa 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -48,16 +48,15 @@ pub struct CLIArgs { /// Create a config file from all the given arguments #[arg(short, long)] pub save: Option, - // /// Connect to a VP - // #[command(subcommand)] - // pub vp: Vec, + + /// Connect to a VP + pub vp: Vec, } /// All arguments for creating a VP configuration #[derive(Debug, Parser, Serialize, Deserialize)] pub struct CreateArgs { /// Create a projector config file of a specific type - #[command(subcommand)] pub create: VPType, /// The name to save it under @@ -135,6 +134,7 @@ impl RMCArgs { midi_interface: _, config: _, save: Some(save_path), + vp: _, }, ), } = &self diff --git a/src/projector/mod.rs b/src/projector/mod.rs index 1005df6..861cb10 100644 --- a/src/projector/mod.rs +++ b/src/projector/mod.rs @@ -3,13 +3,13 @@ pub mod panasonic; pub mod proj_traits; -use clap::Parser; +use clap::ValueEnum; use panasonic::PanasonicProjector; pub use proj_traits::{AdvancedCommands, GenericProjector}; use serde::{Deserialize, Serialize}; /// Enumerate all the VP types -#[derive(Parser, Serialize, Deserialize, Clone, Debug)] +#[derive(ValueEnum, Serialize, Deserialize, Clone, Debug)] pub enum VPType { /// A panasonic VideoProjector Panasonic, -- 2.45.1