mirror of
https://github.com/pcvolkmer/bzkf-rwdp-check.git
synced 2025-04-19 19:16:51 +00:00
feat: add export with semicolon as separator
This commit is contained in:
parent
c4c2297bb0
commit
3684ff8172
@ -93,6 +93,8 @@ pub enum SubCommand {
|
|||||||
year: String,
|
year: String,
|
||||||
#[arg(long, value_parser = value_is_date, help = "Ignoriere LKR-Exporte seit Datum")]
|
#[arg(long, value_parser = value_is_date, help = "Ignoriere LKR-Exporte seit Datum")]
|
||||||
ignore_exports_since: Option<String>,
|
ignore_exports_since: Option<String>,
|
||||||
|
#[arg(long, help = "Export mit Trennzeichen ';' für Excel")]
|
||||||
|
xls_csv: bool,
|
||||||
},
|
},
|
||||||
#[command(about = "Abgleich zwischen CSV-Datei für OPAL und Onkostar-Datenbank")]
|
#[command(about = "Abgleich zwischen CSV-Datei für OPAL und Onkostar-Datenbank")]
|
||||||
Compare {
|
Compare {
|
||||||
|
10
src/main.rs
10
src/main.rs
@ -23,7 +23,7 @@ use std::path::Path;
|
|||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use console::{style, Term};
|
use console::{style, Term};
|
||||||
use csv::Writer;
|
use csv::WriterBuilder;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
use crate::cli::{Cli, SubCommand};
|
use crate::cli::{Cli, SubCommand};
|
||||||
@ -134,6 +134,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
output,
|
output,
|
||||||
year,
|
year,
|
||||||
ignore_exports_since,
|
ignore_exports_since,
|
||||||
|
xls_csv
|
||||||
} => {
|
} => {
|
||||||
let password = request_password_if_none(password);
|
let password = request_password_if_none(password);
|
||||||
let year = sanitize_year(year);
|
let year = sanitize_year(year);
|
||||||
@ -155,7 +156,12 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
|
|
||||||
let _ = term.clear_last_lines(1);
|
let _ = term.clear_last_lines(1);
|
||||||
|
|
||||||
let mut writer = Writer::from_path(Path::new(&output)).expect("writeable file");
|
let writer_builder = &mut WriterBuilder::new();
|
||||||
|
let mut writer_builder = writer_builder.has_headers(true);
|
||||||
|
if xls_csv {
|
||||||
|
writer_builder = writer_builder.delimiter(b';');
|
||||||
|
}
|
||||||
|
let mut writer = writer_builder.from_path(Path::new(&output)).expect("writeable file");
|
||||||
|
|
||||||
items
|
items
|
||||||
.iter()
|
.iter()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user