mirror of
https://github.com/Dummi26/tuifile.git
synced 2025-03-10 11:43:53 +01:00
update doc comment
This commit is contained in:
parent
3b149fe2eb
commit
2fc86655c4
@ -9,7 +9,6 @@ use std::{
|
|||||||
rc::Rc,
|
rc::Rc,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
thread::JoinHandle,
|
thread::JoinHandle,
|
||||||
time::Duration,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use clap::{command, Parser};
|
use clap::{command, Parser};
|
||||||
@ -156,6 +155,7 @@ fn main() -> io::Result<()> {
|
|||||||
/// - F => focus Find/Filter bar
|
/// - F => focus Find/Filter bar
|
||||||
/// - N => New directory from search text
|
/// - N => New directory from search text
|
||||||
/// - C => Copy selected files to this directory.
|
/// - C => Copy selected files to this directory.
|
||||||
|
/// - C => Remove selected files and directories non-recursively
|
||||||
/// - 1-9 or 0 => set recursive depth limit (0 = infinite)
|
/// - 1-9 or 0 => set recursive depth limit (0 = infinite)
|
||||||
/// - T => open terminal here ($TERM)
|
/// - T => open terminal here ($TERM)
|
||||||
/// - E => open in editor ($EDITOR <file/dir>)
|
/// - E => open in editor ($EDITOR <file/dir>)
|
||||||
@ -302,7 +302,7 @@ impl TuiFile {
|
|||||||
}
|
}
|
||||||
pub fn new(current_dir: PathBuf) -> io::Result<Self> {
|
pub fn new(current_dir: PathBuf) -> io::Result<Self> {
|
||||||
// state
|
// state
|
||||||
let (width, height) = terminal::size()?;
|
let (_width, _height) = terminal::size()?;
|
||||||
let updates = u32::MAX;
|
let updates = u32::MAX;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
active: true,
|
active: true,
|
||||||
|
10
src/run.rs
10
src/run.rs
@ -4,7 +4,7 @@ use crossterm::{cursor, queue, style, terminal, ExecutableCommand};
|
|||||||
use regex::RegexBuilder;
|
use regex::RegexBuilder;
|
||||||
|
|
||||||
use crate::updates::Updates;
|
use crate::updates::Updates;
|
||||||
use crate::{tasks, AppCmd, BackgroundTask, DirContent, DirContentType, Focus, Share};
|
use crate::{tasks, AppCmd, DirContent, DirContentType, Focus, Share};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
@ -309,7 +309,7 @@ impl TuiFile {
|
|||||||
text.push(endchar);
|
text.push(endchar);
|
||||||
vec![text.red()]
|
vec![text.red()]
|
||||||
}
|
}
|
||||||
DirContentType::Dir { metadata } => {
|
DirContentType::Dir { metadata: _ } => {
|
||||||
let filenamelen = share.size.0 as usize - 2 - text_charlen;
|
let filenamelen = share.size.0 as usize - 2 - text_charlen;
|
||||||
if entry.name_charlen < filenamelen {
|
if entry.name_charlen < filenamelen {
|
||||||
text.push_str(&entry.name);
|
text.push_str(&entry.name);
|
||||||
@ -335,7 +335,7 @@ impl TuiFile {
|
|||||||
text.push(endchar);
|
text.push(endchar);
|
||||||
vec![text.stylize()]
|
vec![text.stylize()]
|
||||||
}
|
}
|
||||||
DirContentType::File { size, metadata } => {
|
DirContentType::File { size, metadata: _ } => {
|
||||||
let filenamelen =
|
let filenamelen =
|
||||||
share.size.0 as usize - 3 - text_charlen - size.chars().count();
|
share.size.0 as usize - 3 - text_charlen - size.chars().count();
|
||||||
if entry.name_charlen < filenamelen {
|
if entry.name_charlen < filenamelen {
|
||||||
@ -364,7 +364,7 @@ impl TuiFile {
|
|||||||
text.push(endchar);
|
text.push(endchar);
|
||||||
vec![text.stylize()]
|
vec![text.stylize()]
|
||||||
}
|
}
|
||||||
DirContentType::Symlink { metadata } => {
|
DirContentType::Symlink { metadata: _ } => {
|
||||||
let filenamelen = share.size.0 as usize - 2 - text_charlen;
|
let filenamelen = share.size.0 as usize - 2 - text_charlen;
|
||||||
if entry.name_charlen < filenamelen {
|
if entry.name_charlen < filenamelen {
|
||||||
text.push_str(&entry.name);
|
text.push_str(&entry.name);
|
||||||
@ -688,7 +688,7 @@ impl TuiFile {
|
|||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
Event::Paste(e) => {}
|
Event::Paste(_e) => {}
|
||||||
Event::Resize(w, h) => {
|
Event::Resize(w, h) => {
|
||||||
share.size.0 = w;
|
share.size.0 = w;
|
||||||
share.size.1 = h;
|
share.size.1 = h;
|
||||||
|
@ -2,10 +2,9 @@ use std::{
|
|||||||
collections::HashSet,
|
collections::HashSet,
|
||||||
fs, io,
|
fs, io,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
time::Duration,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{updates::Updates, BackgroundTask, Share, TuiFile};
|
use crate::{BackgroundTask, Share};
|
||||||
|
|
||||||
pub(crate) fn task_copy(
|
pub(crate) fn task_copy(
|
||||||
src: Vec<(PathBuf, Vec<(PathBuf, bool)>)>,
|
src: Vec<(PathBuf, Vec<(PathBuf, bool)>)>,
|
||||||
@ -78,7 +77,7 @@ fn copy_dir(
|
|||||||
|
|
||||||
pub(crate) fn task_del(paths: Vec<PathBuf>, share: &mut Share) {
|
pub(crate) fn task_del(paths: Vec<PathBuf>, share: &mut Share) {
|
||||||
share.tasks.push(BackgroundTask::new(move |status| {
|
share.tasks.push(BackgroundTask::new(move |status| {
|
||||||
let mut total: usize = paths.len();
|
let total: usize = paths.len();
|
||||||
for path in paths {
|
for path in paths {
|
||||||
{
|
{
|
||||||
let s = format!("rm {total}");
|
let s = format!("rm {total}");
|
||||||
|
Loading…
Reference in New Issue
Block a user