#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

#19 in #foo

34 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
~62K SLoC