summaryrefslogtreecommitdiffstats
path: root/cli/src/main.rs
blob: 906262a318b505618377e69b673e7331ea170c60 (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
// Command line app for the faktura invicing system
//
// SPDX-FileCopyrightText: 2024 Eilertsens Kodeknekkeri
// SPDX-FileCopyrightText: 2024 Harald Eilertsen
//
// SPDX-License-Identifier: AGPL-3.0-or-later

mod api;

use api::Client;

fn main() -> Result<(), Box<dyn std::error::Error>> {

    let clients = Client::all()?;

    for c in clients {
        print!("{}: {} <{}>", c.id, c.name, c.email);
        if let Some(contact) = c.contact {
            print!(", c/o {}", contact);
        }
        if let Some(address) = c.address {
            print!(", {}", address);
        }
        if let Some(phone) = c.phone {
            print!(", ph: {}", phone);
        }
        if c.vat {
            print!(", VAT");
        }
        println!("");
    }

    Ok(())
}