self.as_short_ascii().map(|x|std::str::from_utf8(x).ok()/* XXX: Silent failure is not a good idea.. We should return an error (or maybe just panic? if there's invalid utf8 here, it shouldn't happen)*/).flatten().map(|s|s.chars())
writeln!(to,"\tAccording to OPTIONS, given input file paths `files...` (or, if empty, paths read from `stdin`), write them to `stdout` ordered by their metadata's timecodes")?;
writeln!(to,"{execp} --help")?;
writeln!(to,"\tPrint this message to `stderr`, then exit with code 0.")?;
write_opt!("-r","--recursive <limit>"=>"Recursively sort input files, up to `<limit>` (set to 0 for infniite); if limit is not specified, recursion is infinite")?;
write_opt!("-a","--atime"=>"Sort by atime")?;
write_opt!("-c","--ctime"=>"Sort by ctime (default)")?;
write_opt!("-m","--mtime"=>"Sort by mtime")?;
write_opt!("-p","--parallel cpus|<max tasks>"=>"Run tasks in parallel, with a max number of tasks being equal `<max tasks>`, or, if 0, to infinity (see `-P`), if 'cpus', to the number of logical CPU cores ({}, default)",*walk::NUM_CPUS)?;
write_opt!("-P","--parallel 0"=>"Run tasks with unbounded parallelism, no limit to the number of walker tasks running at once (note: the physical thread pool will always be the same size regardless of these flags)")?;
write_opt!("-1","--parallel 1"=>"Only let one directory be processed at once")?;
write_opt!("-","--"=>"Stop parsing arguments, treat the rest as input paths")?;
//TODO: Allow controlling failure modes (currently it's hardcoded when walking will fail and why and also kind arbitary; it being controllable would be better).
writeln!(to,"")?;
writeln!(to,"ENV VARS:")?;
writeln!(to,"`RUST_LOG` - Control the logging (to stderr) level.")?;
writeln!(to,r#" "none"-Nooutput.
"error"-Errorsonly.
"warn"-Warningsandabove.
"info"-Informationandabove.
"debug"-Debuginformationandabove.
"trace"-Allrecordedinformation."#)?;
Ok(())
}
#[tokio::main]
#[tokio::main]
asyncfnmain()-> eyre::Result<()>{
asyncfnmain()-> eyre::Result<()>{
init_logging().wrap_err("Failed to set logging handlers")?;
init_logging().wrap_err("Failed to set logging handlers")?;