Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ fn main() -> Result<()> {
walk_options.threads = num_cpus::get();
}

let cross_filesystems = walk_options.cross_filesystems;

let res = match opt.command {
#[cfg(feature = "tui-crossplatform")]
Some(Interactive {
no_entry_check,
input,
}) => {
Some(Interactive { no_entry_check }) => {
use anyhow::{Context, anyhow};
use crosstermion::terminal::{AlternateRawScreen, tui::new_terminal};

Expand All @@ -84,7 +83,7 @@ fn main() -> Result<()> {
walk_options,
byte_format,
!no_entry_check,
extract_paths_maybe_set_cwd(input, !opt.stay_on_filesystem)?,
extract_paths_maybe_set_cwd(opt.input, cross_filesystems)?,
)?;
app.traverse()?;

Expand Down Expand Up @@ -120,7 +119,6 @@ fn main() -> Result<()> {
);
}
Some(Aggregate {
input,
no_total,
no_sort,
statistics,
Expand All @@ -134,7 +132,7 @@ fn main() -> Result<()> {
!no_total,
!no_sort,
byte_format,
extract_paths_maybe_set_cwd(input, !opt.stay_on_filesystem)?,
extract_paths_maybe_set_cwd(opt.input, cross_filesystems)?,
)?;
if statistics {
writeln!(io::stderr(), "{stats:?}").ok();
Expand All @@ -157,7 +155,7 @@ fn main() -> Result<()> {
true,
true,
byte_format,
extract_paths_maybe_set_cwd(opt.input, !opt.stay_on_filesystem)?,
extract_paths_maybe_set_cwd(opt.input, cross_filesystems)?,
)?
.0
}
Expand Down
21 changes: 8 additions & 13 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub struct Args {

/// The amount of threads to use. Defaults to 0, indicating the amount of logical processors.
/// Set to 1 to use only a single thread.
#[clap(short = 't', long = "threads", default_value_t = DEFAULT_THREADS)]
#[clap(short = 't', long = "threads", default_value_t = DEFAULT_THREADS, global = true)]
pub threads: usize,

/// The format with which to print byte counts.
Expand All @@ -63,34 +63,35 @@ pub struct Args {
value_enum,
default_value_t = dft_format(),
ignore_case = true,
global = true,
)]
pub format: ByteFormat,

/// Display apparent size instead of disk usage.
#[clap(short = 'A', long)]
#[clap(short = 'A', long, global = true)]
pub apparent_size: bool,

/// Count hard-linked files each time they are seen
#[clap(short = 'l', long)]
#[clap(short = 'l', long, global = true)]
pub count_hard_links: bool,

/// If set, we will not cross filesystems or traverse mount points
#[clap(short = 'x', long)]
#[clap(short = 'x', long, global = true)]
pub stay_on_filesystem: bool,

/// One or more absolute directories to ignore. Note that these are not ignored if they are passed as input path.
///
/// Hence, they will only be ignored if they are eventually reached as part of the traversal.
#[clap(long = "ignore-dirs", short = 'i', value_parser)]
#[clap(long = "ignore-dirs", short = 'i', value_parser, global = true)]
#[cfg_attr(target_os = "linux", clap(default_values = &["/proc", "/dev", "/sys", "/run"]))]
pub ignore_dirs: Vec<PathBuf>,

/// One or more input files or directories. If unset, we will use all entries in the current working directory.
#[clap(value_parser)]
#[clap(value_parser, global = true)]
pub input: Vec<PathBuf>,

/// Write a log file with debug information, including panics.
#[clap(long)]
#[clap(long, global = true)]
pub log_file: Option<PathBuf>,
}

Expand All @@ -103,9 +104,6 @@ pub enum Command {
/// Do not check entries for presence when listing a directory to avoid slugging performance on slow filesystems.
#[clap(long, short = 'e')]
no_entry_check: bool,
/// One or more input files or directories. If unset, we will use all entries in the current working directory.
#[clap(value_parser)]
input: Vec<PathBuf>,
},
/// Aggregate the consumed space of one or more directories or files
#[clap(name = "aggregate", visible_alias = "a")]
Expand All @@ -120,9 +118,6 @@ pub enum Command {
/// If set, no total column will be computed for multiple inputs
#[clap(long)]
no_total: bool,
/// One or more input files or directories. If unset, we will use all entries in the current working directory.
#[clap(value_parser)]
input: Vec<PathBuf>,
},
/// Generate shell completions
Completions {
Expand Down
Loading