mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fmt
This commit is contained in:
parent
f5da79f302
commit
a2ea22a5f2
2 changed files with 51 additions and 53 deletions
|
|
@ -1,16 +1,15 @@
|
|||
use std::{borrow::Cow, collections::{HashMap, HashSet}, ffi::{OsStr, OsString}, io::{stderr, BufWriter, Write}, path::PathBuf};
|
||||
use std::{borrow::Cow, collections::{HashMap, HashSet}, ffi::{OsStr, OsString}, io::{BufWriter, Write, stderr}, path::PathBuf};
|
||||
|
||||
use anyhow::{Result, anyhow};
|
||||
use scopeguard::defer;
|
||||
use tokio::{io::{AsyncReadExt, AsyncWriteExt, stdin}};
|
||||
use tokio::fs;
|
||||
use tokio::{fs, io::{AsyncReadExt, AsyncWriteExt, stdin}};
|
||||
use yazi_config::{OPEN, PREVIEW};
|
||||
use yazi_dds::Pubsub;
|
||||
use yazi_fs::{max_common_root, maybe_exists, ok_or_not_found, paths_to_same_file, realname, File, FilesOp};
|
||||
use yazi_fs::{File, FilesOp, max_common_root, maybe_exists, ok_or_not_found, paths_to_same_file, realname};
|
||||
use yazi_proxy::{AppProxy, HIDER, TasksProxy, WATCHER};
|
||||
use yazi_shared::{terminal_clear, url::{Url, UrnBuf}};
|
||||
|
||||
use crate::manager:: Manager;
|
||||
use crate::manager::Manager;
|
||||
|
||||
impl Manager {
|
||||
pub(super) fn bulk_create(&self) {
|
||||
|
|
@ -33,11 +32,11 @@ impl Manager {
|
|||
AppProxy::stop().await;
|
||||
|
||||
let new: Vec<_> = fs::read_to_string(&tmp).await?.lines().map(Url::from).collect();
|
||||
Self::bulk_create_do( new).await
|
||||
Self::bulk_create_do(new).await
|
||||
});
|
||||
}
|
||||
|
||||
async fn bulk_create_do(new:Vec<Url>) -> Result<()> {
|
||||
async fn bulk_create_do(new: Vec<Url>) -> Result<()> {
|
||||
terminal_clear(&mut stderr())?;
|
||||
if new.is_empty() {
|
||||
return Ok(());
|
||||
|
|
@ -48,7 +47,7 @@ impl Manager {
|
|||
for n in &new {
|
||||
if n.to_str().unwrap().ends_with('/') || n.to_str().unwrap().ends_with('\\') {
|
||||
writeln!(stderr, "create new dir-> {}", n.display())?;
|
||||
}else{
|
||||
} else {
|
||||
writeln!(stderr, "create new file-> {}", n.display())?;
|
||||
}
|
||||
}
|
||||
|
|
@ -96,8 +95,6 @@ impl Manager {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if !succeeded.is_empty() {
|
||||
Pubsub::pub_from_bulk(succeeded.iter().map(|(o, n)| (o, &n.url)).collect());
|
||||
FilesOp::create(succeeded.into_values().collect());
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ impl FilesOp {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create(files: Vec<File>) {
|
||||
let mut parents: HashMap<_, Vec<_>> = Default::default();
|
||||
for file in files {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue