#path #directory #file #recursion #suffix #file-search #tiny

ls-option

a tiny and simple option tools for ls-like functionality

6 releases

0.1.5 Apr 16, 2024
0.1.4 Apr 16, 2024

#779 in Filesystem

MIT license

11KB
180 lines

ls-option: a tiny and simple to used library for ls-like functionality in pure Rust

Quick Start

# try to list all files with suffix `.rs` in current path
cargo run --example list_all_rs
# try to list paths in an unexisted path
cargo run --example list_unexisted_path

Example 1:

    use ls_option::*;
    let fs = ListOption::default()
        // allow to show file
        .file(true)
        // not allow to show dir
        .dir(false)
        // allow to show unhidden
        .unhidden(true)
        // not allow to show hidden
        .hidden(false)
        // walk recursively to search path
        .recursive(true)
        // only show path with one of these suffix
        .sufs(vec![".rs"])
        // start list the expected path search from `.`
        .list(".");
    dbg!(fs);

License

MIT

No runtime deps