wip translation system
This commit is contained in:
+14
-5
@@ -10,10 +10,12 @@ extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate thiserror;
|
||||
|
||||
use std::sync::Arc;
|
||||
use clap::Arg;
|
||||
use log::LevelFilter;
|
||||
|
||||
use crate::store::{NewGroupOptions, StoreOptions};
|
||||
use crate::tr::TranslationTable;
|
||||
use crate::utils::acct_to_server;
|
||||
|
||||
mod command;
|
||||
@@ -22,6 +24,9 @@ mod group_handler;
|
||||
mod store;
|
||||
mod utils;
|
||||
|
||||
#[macro_use]
|
||||
mod tr;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let args = clap::App::new("groups")
|
||||
@@ -90,7 +95,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
.filter_module("mio", LevelFilter::Warn)
|
||||
.init();
|
||||
|
||||
let store = store::ConfigStore::load_from_fs(StoreOptions {
|
||||
let mut store = store::ConfigStore::load_from_fs(StoreOptions {
|
||||
store_dir: args.value_of("config").unwrap_or(".").to_string(),
|
||||
})
|
||||
.await?;
|
||||
@@ -104,14 +109,14 @@ async fn main() -> anyhow::Result<()> {
|
||||
}
|
||||
|
||||
if let Some(server) = acct_to_server(acct) {
|
||||
let g = store
|
||||
store
|
||||
.auth_new_group(NewGroupOptions {
|
||||
server: format!("https://{}", server),
|
||||
acct: acct.to_string(),
|
||||
})
|
||||
.await?;
|
||||
|
||||
eprintln!("New group @{} added to config!", g.config.get_acct());
|
||||
eprintln!("New group added to config!");
|
||||
return Ok(());
|
||||
} else {
|
||||
anyhow::bail!("--auth handle must be username@server, got: \"{}\"", handle);
|
||||
@@ -120,13 +125,17 @@ async fn main() -> anyhow::Result<()> {
|
||||
|
||||
if let Some(acct) = args.value_of("reauth") {
|
||||
let acct = acct.trim_start_matches('@');
|
||||
let _ = store.reauth_group(acct).await?;
|
||||
store.reauth_group(acct).await?;
|
||||
eprintln!("Group @{} re-authed!", acct);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
store.find_locales().await;
|
||||
|
||||
return Ok(());
|
||||
|
||||
// Start
|
||||
let groups = store.spawn_groups().await?;
|
||||
let groups = Arc::new(store).spawn_groups().await?;
|
||||
|
||||
let mut handles = vec![];
|
||||
for mut g in groups {
|
||||
|
||||
Reference in New Issue
Block a user