From 9c45e4fd70ed83bd2c203da225777ad670c2c15c Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 22 Apr 2024 18:48:16 +0200 Subject: Initial commit --- cli/src/main.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 cli/src/main.rs (limited to 'cli/src/main.rs') diff --git a/cli/src/main.rs b/cli/src/main.rs new file mode 100644 index 0000000..906262a --- /dev/null +++ b/cli/src/main.rs @@ -0,0 +1,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> { + + 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(()) +} -- cgit v1.2.3