about summary refs log tree commit diff stats
path: root/crates
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-10-23 23:39:53 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-10-23 23:39:53 +0200
commite405f8477865d00c90d396d8b5a26553d7779940 (patch)
treea833f40e6f7711166b80956cbd061509b08930a9 /crates
parentfix(crates/rocie-server/api/buy-barcode): Allow specifying how often to buy (diff)
downloadserver-e405f8477865d00c90d396d8b5a26553d7779940.zip
fix(crates/rocie-cli): Handle updates to `buy-barcode`
Diffstat (limited to 'crates')
-rw-r--r--crates/rocie-cli/src/cli.rs4
-rw-r--r--crates/rocie-cli/src/handle/mod.rs4
2 files changed, 6 insertions, 2 deletions
diff --git a/crates/rocie-cli/src/cli.rs b/crates/rocie-cli/src/cli.rs
index a84ab0e..a683306 100644
--- a/crates/rocie-cli/src/cli.rs
+++ b/crates/rocie-cli/src/cli.rs
@@ -109,6 +109,10 @@ pub(crate) enum BarcodeCommand {
         /// The numeric value of the barcode
         #[arg(short, long)]
         id: u32,
+
+        /// How often to buy this barcode
+        #[arg(short, long, default_value = "1")]
+        times: u16,
     },
 
     /// Consume an barcode
diff --git a/crates/rocie-cli/src/handle/mod.rs b/crates/rocie-cli/src/handle/mod.rs
index 101f56d..929c0ff 100644
--- a/crates/rocie-cli/src/handle/mod.rs
+++ b/crates/rocie-cli/src/handle/mod.rs
@@ -148,8 +148,8 @@ pub(crate) async fn product(config: &Configuration, command: ProductCommand) ->
 
 pub(crate) async fn barcode(config: &Configuration, command: BarcodeCommand) -> Result<()> {
     match command {
-        BarcodeCommand::Buy { id } => {
-            buy_barcode(config, BarcodeId { value: id }).await?;
+        BarcodeCommand::Buy { id, times } => {
+            buy_barcode(config, BarcodeId { value: id }, u32::from(times)).await?;
         }
         BarcodeCommand::Consume {
             id,