frontend: example: csv-import helper
* cli to import a given csv configured text file Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
58
frontend/examples/csv-import/csv_import.rs
Normal file
58
frontend/examples/csv-import/csv_import.rs
Normal file
@@ -0,0 +1,58 @@
|
||||
/// Commandline program testing csv imports
|
||||
use log::{info, trace, warn};
|
||||
use serde::Deserialize;
|
||||
use std::{
|
||||
error::Error,
|
||||
io,
|
||||
process,
|
||||
thread,
|
||||
time::{Duration, Instant}};
|
||||
|
||||
mod parse_args;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Environment {
|
||||
test_lang: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct CsvImportRecord {
|
||||
// dion => Allianz Dion: 1
|
||||
// policy_code => Policy Typ: "AS"
|
||||
// policy_number => Versicherungsscheinnummer: "1515735810"
|
||||
pub dion: String,
|
||||
pub policy_code: String,
|
||||
pub policy_number: u32,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
use parse_args::parse_args;
|
||||
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::process;
|
||||
use std::sync::Arc;
|
||||
|
||||
use viperus::Viperus;
|
||||
|
||||
// initialize logger
|
||||
env_logger::init();
|
||||
info!("Commencing the proxy!");
|
||||
|
||||
// initialize viperus structure
|
||||
let mut v = Viperus::new();
|
||||
|
||||
// parse commandline arguments
|
||||
info!(target: "csv_import", "parsing commandline args");
|
||||
parse_args(&mut v)?;
|
||||
trace!(target: "Viperus", "Config results: {:?}", v);
|
||||
|
||||
// create a new NextCloudTalk client
|
||||
let config = matches.value_of("config").unwrap_or("advotracker.conf");
|
||||
let csv_import = matches.value_of("import").unwrap_or("allianz.txt");
|
||||
//let username = matches.value_of("username").unwrap_or("nctalkbot");
|
||||
//let password = matches.value_of("password").unwrap_or("botpassword");
|
||||
let verbose = matches.occurrences_of("verbose");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user