about summary refs log tree commit diff stats
path: root/crates/rocie-cli/src/main.rs
blob: cea863b5ab4dcccd1dc41631eefa88f8c26ae843 (plain) (blame)
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
// rocie - An enterprise grocery management system
//
// Copyright (C) 2026 Benedikt Peetz <benedikt.peetz@b-peetz.de>
// SPDX-License-Identifier: GPL-3.0-or-later
//
// This file is part of Rocie.
//
// You should have received a copy of the License along with this program.
// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.

use anyhow::Result;
use clap::Parser;
use rocie_client::apis::configuration::Configuration;

use crate::cli::{CliArgs, Command};

mod cli;
mod handle;

#[tokio::main]
async fn main() -> Result<()> {
    let args = CliArgs::parse();

    let mut config = Configuration::new();
    "http://127.0.0.1:8080".clone_into(&mut config.base_path);

    match args.command {
        Command::Product { command } => handle::product(&config, command).await?,
        Command::Unit { command } => handle::unit(&config, command).await?,
        Command::Barcode { command } => handle::barcode(&config, command).await?,
        Command::UnitProperty { command } => handle::unit_property(&config, command).await?,
        Command::Parents { command } => todo!(),
        Command::User { command } => handle::user(&config, command).await?,
    }

    Ok(())
}