Skip to content

Rust implementation of the POSIX `ls` command

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

MitchelAnthony/lst

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LST

Rust implementation of the POSIX ls command.

Crates.io Documentation Dependency status

How to use

This example will print a string with all non-hidden file and directory names, sorted by creation time.

use anyhow::Result;
use lst::filters::DotFilesFilter;
use lst::formatters::NameOnlyFormatter;
use lst::readers::FileSystemReader;
use lst::sorters::TimeSorter;
use lst::validators::FileSystemValidator;
use lst::{Location, Lst};

fn main() -> Result<()> {
  let mut lst = Lst::new(Location::new("./"));
  lst.validator(FileSystemValidator::new())
     .reader(FileSystemReader::new())
     .filter(Box::new(DotFilesFilter::new()))
     .sorter(Box::new(TimeSorter::new()))
     .formatter(NameOnlyFormatter::new());
  
  println!("{}", lst.generate()?);
  
  Ok(())
}

License

Licensed under either of

at your option.

Contribution

Any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Rust implementation of the POSIX `ls` command

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages