listing all files
This commit is contained in:
parent
ddd620a021
commit
9fe6ae5eb8
|
|
@ -17,6 +17,9 @@ pub struct Args {
|
|||
/// list closest files to date
|
||||
#[arg(short, long)]
|
||||
pub list: bool,
|
||||
/// number of files to list
|
||||
#[arg(short, long, default_value_t = 5)]
|
||||
pub number: usize,
|
||||
/// list closest files to date
|
||||
#[arg(short = 'L', long)]
|
||||
pub list_all: bool,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,11 @@ fn main() {
|
|||
|
||||
let today = Local::now().date_naive();
|
||||
let target = today - TimeDelta::try_days(args.previous.into()).unwrap();
|
||||
let closest_files = TodoFile::get_closest_files(files.collect(), target, 5);
|
||||
if args.list_all {
|
||||
files.for_each(|f| println!("{}", f.canonicalize().unwrap().to_string_lossy()));
|
||||
return ();
|
||||
}
|
||||
let closest_files = TodoFile::get_closest_files(files.collect(), target, args.number);
|
||||
if args.list {
|
||||
closest_files
|
||||
.into_iter()
|
||||
|
|
|
|||
Loading…
Reference in New Issue