change default target language to german

master
Mathias Rothenhaeusler 2023-08-10 19:00:53 +02:00
parent c33c579382
commit 78d07680c9
2 changed files with 17 additions and 7 deletions

View File

@ -22,7 +22,11 @@ impl Params {
Err(_) => {
return Err(format!(
"Could not load .env file {:?}",
base_dir.config_dir().join("deepl/.env").as_path()
base_dir
.config_dir()
.join("deepl/.env")
.as_path()
.as_os_str()
));
}
};
@ -32,7 +36,7 @@ impl Params {
Ok(Self {
source_lang: matches.value_of("source").unwrap_or("0").to_string(),
target_lang: matches.value_of("target").unwrap_or("EN-US").to_string(),
target_lang: matches.value_of("target").unwrap_or("DE").to_string(),
key: env::var("KEY").unwrap(),
uri: env::var("URI").unwrap(),
text: matches.value_of("INPUT").unwrap().to_string(),

View File

@ -1,17 +1,23 @@
mod engine;
use hyper::{Body, Client, Method, Request, body};
use hyper_tls::HttpsConnector;
use crate::engine::params::Params;
use crate::engine::response::DeeplResponse;
use hyper::{body, Body, Client, Method, Request};
use hyper_tls::HttpsConnector;
#[tokio::main(flavor = "current_thread")]
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let https = HttpsConnector::new();
let client = Client::builder().build::<_, hyper::Body>(https);
let params = Params::new()?;
// let params: Params = Params::new()?;
let params: Params = match Params::new() {
Ok(result) => result,
Err(e) => {
eprintln!("{}", e);
return Ok(());
},
};
let request = Request::builder()
.method(Method::POST)