1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
use clap::{Parser, Subcommand};
use uuid::Uuid;
#[derive(Parser)]
pub(crate) struct CliArgs {
#[command(subcommand)]
pub(crate) command: Command,
}
#[derive(Subcommand)]
pub(crate) enum Command {
/// Deal with products
Product {
#[command(subcommand)]
command: ProductCommand,
},
}
#[derive(Subcommand)]
pub(crate) enum ProductCommand {
/// Register a new product
Register {
/// The name of new the product
#[arg(short, long)]
name: String,
/// Optional description of the new the product
#[arg(short, long)]
description: Option<String>,
/// Optional parent of the new the product
#[arg(short, long)]
parent: Option<Uuid>,
},
AssociateBarcode {
/// The id of the product to associated the barcode with
#[arg(short, long)]
product_id: Uuid,
/// The barcode number
#[arg(short, long)]
barcode_number: u32,
/// The quantity of amount, this barcode signifies
#[arg(short = 'v', long)]
amount_value: u32,
/// The unit the amount value is in
#[arg(short = 'u', long)]
amount_unit: String,
},
/// Get a already registered product by id
Get {
/// The id of the product
#[arg(short, long)]
id: Uuid,
},
/// List all available products
List {},
}
|