Merge branch 'develop' into feature/rebuild_share

This commit is contained in:
Jörn-Michael Miehe 2025-06-24 00:23:09 +00:00
commit 5b403ea129
5 changed files with 10 additions and 20 deletions

View file

@ -53,3 +53,4 @@
- hashing - hashing
- store file hashes with all `file::*` variants - store file hashes with all `file::*` variants
- check hashes on "continue" - check hashes on "continue"
- CLI switch to skip hashing

View file

@ -86,9 +86,8 @@ impl AppState {
bar.set_position(upl.get_offset()); bar.set_position(upl.get_offset());
// BUG in `indicatif` crate? // BUG in `indicatif` crate?
// `set_position` does not force an immediate redraw, so we also call `inc_length` here // `set_position` does not force an immediate redraw, so we need to call `set_length` after
bar.set_length(upl.get_size()); bar.set_length(upl.get_size());
// bar.inc_length(0);
f(bar); f(bar);
@ -163,13 +162,10 @@ impl AppState {
self.http self.http
.share_create(&args.get_uri(), &args.alias, args.get_share_request())?; .share_create(&args.get_uri(), &args.alias, args.get_share_request())?;
self.with_progressbar(true, ProgressBar::abandon);
Ok(Self::new(self.http, CacheFile::from_args(args, share_id))) Ok(Self::new(self.http, CacheFile::from_args(args, share_id)))
} }
pub fn file_names(&self) -> Vec<&str> {
self.inner.file_names()
}
pub fn save(&self) -> io::Result<()> { pub fn save(&self) -> io::Result<()> {
self.inner.save() self.inner.save()
} }

View file

@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize};
use crate::{ use crate::{
cli::Cli, cli::Cli,
file::{self, Chunk, FileTrait}, file::{self, Chunk},
sharry::{self, Client, Uri}, sharry::{self, Client, Uri},
}; };
@ -67,17 +67,6 @@ impl CacheFile {
} }
} }
pub fn file_names(&self) -> Vec<&str> {
let mut result = vec![];
if let Some(upl) = self.uploading.as_ref() {
result.push(upl.get_name());
}
self.files.iter().map(|chk| result.push(chk.get_name()));
result
}
pub fn queue_empty(&self) -> bool { pub fn queue_empty(&self) -> bool {
self.files.is_empty() self.files.is_empty()
} }

View file

@ -14,7 +14,7 @@ use clap::{
use log::LevelFilter; use log::LevelFilter;
use crate::{ use crate::{
file::Checked, file::{Checked, FileTrait},
sharry::{NewShareRequest, Uri}, sharry::{NewShareRequest, Uri},
}; };
@ -130,6 +130,10 @@ impl Cli {
} }
} }
pub fn file_names(&self) -> Vec<&str> {
self.files.iter().map(FileTrait::get_name).collect()
}
pub fn get_hash(&self) -> String { pub fn get_hash(&self) -> String {
let file_refs = { let file_refs = {
let mut refs: Vec<_> = self.files.iter().collect(); let mut refs: Vec<_> = self.files.iter().collect();

View file

@ -73,7 +73,7 @@ fn main() {
info!("continuing with state: {state:#?}"); info!("continuing with state: {state:#?}");
let fns_magenta = output::style_all(&state.file_names(), |s| style(s).magenta()).join(", "); let fns_magenta = output::style_all(&args.file_names(), |s| style(s).magenta()).join(", ");
println!("{} is uploading: {fns_magenta}", *SHRUPL); println!("{} is uploading: {fns_magenta}", *SHRUPL);