diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2024-04-22 18:48:16 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2024-04-22 18:48:16 +0200 |
commit | 9c45e4fd70ed83bd2c203da225777ad670c2c15c (patch) | |
tree | 7f1be79d99b3e806094fc89622802063b98d7f8e /cli/src/main.rs | |
download | faktura-9c45e4fd70ed83bd2c203da225777ad670c2c15c.tar.gz faktura-9c45e4fd70ed83bd2c203da225777ad670c2c15c.tar.bz2 faktura-9c45e4fd70ed83bd2c203da225777ad670c2c15c.zip |
Initial commit
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(()) +} |