diff options
Diffstat (limited to 'cli/src/main.rs')
-rw-r--r-- | cli/src/main.rs | 34 |
1 files changed, 34 insertions, 0 deletions
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<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(()) +} |