wip: main business logic
This commit is contained in:
parent
666aae5a46
commit
7e9d553ef8
2 changed files with 10 additions and 8 deletions
|
|
@ -5,7 +5,7 @@ use std::{
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
|
|
||||||
use log::{debug, error, trace};
|
use log::{debug, trace};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
|
@ -74,7 +74,7 @@ impl AppState {
|
||||||
let alias = args.get_alias();
|
let alias = args.get_alias();
|
||||||
|
|
||||||
let share = Share::create(http, &alias, args.get_share_request())
|
let share = Share::create(http, &alias, args.get_share_request())
|
||||||
.inspect_err(|e| error!("could not create Share: {e}"))
|
.inspect_err(|e| debug!("could not create Share: {e}"))
|
||||||
.ok()?;
|
.ok()?;
|
||||||
|
|
||||||
let files: VecDeque<_> = args.files.clone().into_iter().map(FileState::C).collect();
|
let files: VecDeque<_> = args.files.clone().into_iter().map(FileState::C).collect();
|
||||||
|
|
|
||||||
14
src/main.rs
14
src/main.rs
|
|
@ -2,9 +2,12 @@ mod appstate;
|
||||||
mod cli;
|
mod cli;
|
||||||
mod sharry;
|
mod sharry;
|
||||||
|
|
||||||
use std::sync::{
|
use std::{
|
||||||
Arc,
|
process::exit,
|
||||||
atomic::{AtomicBool, Ordering},
|
sync::{
|
||||||
|
Arc,
|
||||||
|
atomic::{AtomicBool, Ordering},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
@ -41,8 +44,7 @@ fn main() {
|
||||||
.or_else(|| AppState::from_args(&args, &agent))
|
.or_else(|| AppState::from_args(&args, &agent))
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
error!("could not create new state from cli arguments: {args:?}");
|
error!("could not create new state from cli arguments: {args:?}");
|
||||||
|
exit(1);
|
||||||
std::process::exit(1);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
info!("continuing with state: {state:?}");
|
info!("continuing with state: {state:?}");
|
||||||
|
|
@ -59,7 +61,7 @@ fn main() {
|
||||||
|
|
||||||
if !running.load(Ordering::SeqCst) {
|
if !running.load(Ordering::SeqCst) {
|
||||||
info!("terminating ...");
|
info!("terminating ...");
|
||||||
std::process::exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue