#expand #group #foo #glob #glob-expr

bin+lib globgroups

Expands groups like foo{a,b}

2 releases

0.1.0-beta.2 Mar 18, 2024

#12 in #foo

Download history 260/week @ 2024-03-17 4/week @ 2024-03-24 43/week @ 2024-03-31 2/week @ 2024-04-07

309 downloads per month

BlueOak-1.0.0

21KB
539 lines

globgroups

Expands glob groups like foo{bar,baz} -> ["foobar", "foobaz"]

Does not (currently) support wildcards like *.txt, because those are context-sensitive.

Examples

use globgroups::GlobExpr;

fn simple() {
    let glob: GlobExpr = "foo-{bar,baz}-suffix".parse().unwrap();
    assert_eq!(
        glob.expand().collect::<Vec<String>>(),
        vec![
            "foo-bar-suffix",
            "foo-baz-suffix"
        ]
    )
}

Notes

There is an old python version in misc/globgroups.py

Dependencies

~3.5MB
~63K SLoC