|
|
@ -1,6 +1,7 @@
|
|
|
|
//! Argument parsing and handling
|
|
|
|
//! Argument parsing and handling
|
|
|
|
use super::*;
|
|
|
|
use super::*;
|
|
|
|
use std::num::NonZeroUsize;
|
|
|
|
use std::num::NonZeroUsize;
|
|
|
|
|
|
|
|
use std::fmt;
|
|
|
|
|
|
|
|
|
|
|
|
use config::Config;
|
|
|
|
use config::Config;
|
|
|
|
|
|
|
|
|
|
|
@ -21,6 +22,40 @@ pub fn program_name() -> &'static str
|
|
|
|
eprintln!("Made by {} with <3.\n Licensed with GPL v3.0 +", env!("CARGO_PKG_AUTHORS"));
|
|
|
|
eprintln!("Made by {} with <3.\n Licensed with GPL v3.0 +", env!("CARGO_PKG_AUTHORS"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const OPTIONS_NORMAL: &'static [&'static str] = &[
|
|
|
|
|
|
|
|
"--recursive <number> Set max directory recursion depth limit (1 = No recursion (default), 0 = Unlimited recursion).",
|
|
|
|
|
|
|
|
"-r Set unlimited directory recursion depth. (same as `--recursive 0`).",
|
|
|
|
|
|
|
|
"--threads <number> Limit the maximum number of tasks allowed to process concurrently (Set to 0 for unlimited.)",
|
|
|
|
|
|
|
|
"-M Set number of parallel running tasks to unlimited. (Same as `--threads 0`). (default).",
|
|
|
|
|
|
|
|
"-m Limit number of parallel tasks to the number of active CPU processors.",
|
|
|
|
|
|
|
|
"-q Quiet mode. Don't output info messages about successful `stat`ing.",
|
|
|
|
|
|
|
|
"-Q Silent mode. Don't output any messages.",
|
|
|
|
|
|
|
|
"-v Verbose mode. Output extra information.",
|
|
|
|
|
|
|
|
#[cfg(feature="inspect")] "--save <file> Dump the collected data to this file for further inspection.",
|
|
|
|
|
|
|
|
#[cfg(feature="inspect")] "-D Dump the collected data to `stdout` (see `--save`.)",
|
|
|
|
|
|
|
|
"- Stop parsing arguments, treat all the rest as paths.",
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn get_opt_normal() -> impl fmt::Display
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
|
|
|
struct Opt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl fmt::Display for Opt
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for line in OPTIONS_NORMAL.iter()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
writeln!(f, " {}", line)?;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Opt
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Print usage message
|
|
|
|
/// Print usage message
|
|
|
|
pub fn usage()
|
|
|
|
pub fn usage()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -33,17 +68,7 @@ pub fn usage()
|
|
|
|
println!("{} --help", program_name());
|
|
|
|
println!("{} --help", program_name());
|
|
|
|
println!(r#"
|
|
|
|
println!(r#"
|
|
|
|
OPTIONS:
|
|
|
|
OPTIONS:
|
|
|
|
--recursive <number> Set max directory recursion depth limit (1 = No recursion (default), 0 = Unlimited recursion).
|
|
|
|
{}
|
|
|
|
-r Set unlimited directory recursion depth. (same as `--recursive 0`).
|
|
|
|
|
|
|
|
--threads <number> Limit the maximum number of tasks allowed to process concurrently (Set to 0 for unlimited.)
|
|
|
|
|
|
|
|
-M Set number of parallel running tasks to unlimited. (Same as `--threads 0`). (default).
|
|
|
|
|
|
|
|
-m Limit number of parallel tasks to the number of active CPU processors.
|
|
|
|
|
|
|
|
-q Quiet mode. Don't output info messages about successful `stat`ing.
|
|
|
|
|
|
|
|
-Q Silent mode. Don't output any messages.
|
|
|
|
|
|
|
|
-v Verbose mode. Output extra information.
|
|
|
|
|
|
|
|
--save <file> Dump the collected data to this file for further inspection (only available when compiled with feature `inspect`)
|
|
|
|
|
|
|
|
-D Dump the collected data to `stdout` (see `--save`) (only available when compiled with feature `inspect`)
|
|
|
|
|
|
|
|
- Stop parsing arguments, treat all the rest as paths.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--help Print this message and exit.
|
|
|
|
--help Print this message and exit.
|
|
|
|
|
|
|
|
|
|
|
@ -52,7 +77,7 @@ NOTES:
|
|
|
|
If parallelism is set to unlimited, there can be a huge syscall overhead. It is recommended to use `-m`.
|
|
|
|
If parallelism is set to unlimited, there can be a huge syscall overhead. It is recommended to use `-m`.
|
|
|
|
|
|
|
|
|
|
|
|
Symlinks are ignored while collection stat data. They will fail with message 'Unknown file type'. Symlinks are generally very small in the actual data they contain themselves, so this is *usually* unimportant.
|
|
|
|
Symlinks are ignored while collection stat data. They will fail with message 'Unknown file type'. Symlinks are generally very small in the actual data they contain themselves, so this is *usually* unimportant.
|
|
|
|
"#);
|
|
|
|
"#, get_opt_normal());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Print usage message then exit with code 1.
|
|
|
|
/// Print usage message then exit with code 1.
|
|
|
|